Skip to content

Commit 1acb9ea

Browse files
committed
Bug 1855749 - Part 3: Correctly handle ignorePunctuation option. r=dminor
The default value for `GetOption` in `InitializeCollator` is changed from `false` to `undefined` to avoid having to `intl_isIgnorePunctuation` in the constructor function. The corresponding spec PR is <tc39/ecma402#833>, but our behaviour is already not strictly spec-compliant as described in <tc39/ecma402#832>, so it seems reasonable to simply implement the spec PR ahead of time. (We don't want to "fix" our implementation to strictly follow the spec without the PR, because that could be web-incompatible resp. at least disruptive for Thai users, which currently already get the expected behaviour where punctuation characters are ignored in Thai.) Differential Revision: https://phabricator.services.mozilla.com/D189545 UltraBlame original commit: bcf3b4652f995f4f52792d5897cd2d905d5a029f
1 parent 5218411 commit 1acb9ea

File tree

4 files changed

+464
-27
lines changed

4 files changed

+464
-27
lines changed

intl/components/src/Collator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ Collator
12161216
AlternateHandling
12171217
:
12181218
:
1219-
Default
1219+
NonIgnorable
12201220
)
12211221
;
12221222
if

js/src/builtin/intl/Collator.js

+37-3
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,46 @@ s
395395
Step
396396
28
397397
.
398-
internalProps
399-
.
398+
var
400399
ignorePunctuation
401400
=
402401
lazyCollatorData
403402
.
404403
ignorePunctuation
405404
;
405+
if
406+
(
407+
ignorePunctuation
408+
=
409+
=
410+
=
411+
undefined
412+
)
413+
{
414+
var
415+
actualLocale
416+
=
417+
collatorActualLocale
418+
(
419+
r
420+
.
421+
dataLocale
422+
)
423+
;
424+
ignorePunctuation
425+
=
426+
intl_isIgnorePunctuation
427+
(
428+
actualLocale
429+
)
430+
;
431+
}
432+
internalProps
433+
.
434+
ignorePunctuation
435+
=
436+
ignorePunctuation
437+
;
406438
/
407439
/
408440
The
@@ -843,6 +875,8 @@ true
843875
/
844876
false
845877
/
878+
undefined
879+
/
846880
/
847881
}
848882
/
@@ -1316,7 +1350,7 @@ ignorePunctuation
13161350
boolean
13171351
"
13181352
undefined
1319-
false
1353+
undefined
13201354
)
13211355
;
13221356
lazyCollatorData

js/src/tests/jstests.list

-23
Original file line numberDiff line numberDiff line change
@@ -16054,29 +16054,6 @@ emoji
1605416054
.
1605516055
js
1605616056
#
16057-
Default
16058-
value
16059-
for
16060-
ignorePunctuation
16061-
incorrectly
16062-
computed
16063-
.
16064-
skip
16065-
script
16066-
test262
16067-
/
16068-
intl402
16069-
/
16070-
Collator
16071-
/
16072-
prototype
16073-
/
16074-
compare
16075-
/
16076-
ignorePunctuation
16077-
.
16078-
js
16079-
#
1608016057
Time
1608116058
zone
1608216059
canonicalization

0 commit comments

Comments
 (0)