Skip to content

Commit d74d4ff

Browse files
committed
[searchcursor addon] Normalize strings when supported
Issue #4784
1 parent db1908a commit d74d4ff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

addon/search/searchcursor.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,14 @@
115115
}
116116
}
117117

118-
function doFold(str) { return str.toLowerCase() }
119-
function noFold(str) { return str }
118+
var doFold, noFold
119+
if (String.prototype.normalize) {
120+
doFold = function(str) { return str.normalize("NFD").toLowerCase() }
121+
noFold = function(str) { return str.normalize("NFD") }
122+
} else {
123+
doFold = function(str) { return str.toLowerCase() }
124+
noFold = function(str) { return str }
125+
}
120126

121127
// Maps a position in a case-folded line back to a position in the original line
122128
// (compensating for codepoints increasing in number during folding)

0 commit comments

Comments
 (0)