Skip to content

Commit 9f9ed49

Browse files
committed
add comment
1 parent 1145e2d commit 9f9ed49

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/stringutil/js_case.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ func isFinalSigmaContext(runes []rune, index int) bool {
9393
// ECMAScript points at Unicode Default Case Conversion for toLowerCase, and
9494
// modern V8 reaches that behavior through Intl::ConvertToLower, which uses
9595
// ICU root-locale lowercasing for non-Latin1 strings like Greek sigma.
96+
// We intentionally do not delegate this to golang.org/x/text/cases: x/text
97+
// is a general Unicode casing library, but its root-locale behavior is not
98+
// an exact match for the JS semantics exercised by String.prototype
99+
// .toLowerCase(), especially around Final_Sigma context. TypeScript needs the
100+
// JS behavior itself here, so we keep the context-sensitive part explicit.
96101
// SpiderMonkey models Final_Sigma with a more explicit context walk, while
97102
// Unicode Table 3-17 describes it in terms of Cased and Case_Ignorable.
98103
// We model the exposed V8/ICU behavior directly here: skip Case_Ignorable

0 commit comments

Comments
 (0)