tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

constructor-apply-options-canonicalizes-twice.js (1051B)


      1 // Copyright 2020 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-apply-options-to-tag
      6 description: >
      7    ApplyOptionsToTag canonicalises the language tag two times.
      8 info: |
      9    10.1.1 ApplyOptionsToTag( tag, options )
     10 
     11    ...
     12    9. Set tag to CanonicalizeUnicodeLocaleId(tag).
     13    10. If language is not undefined,
     14        ...
     15        b. Set tag to tag with the substring corresponding to the unicode_language_subtag
     16           production of the unicode_language_id replaced by the string language.
     17    ...
     18    13. Return CanonicalizeUnicodeLocaleId(tag).
     19 features: [Intl.Locale]
     20 ---*/
     21 
     22 // ApplyOptionsToTag canonicalises the locale identifier before applying the
     23 // options. That means "und-Armn-SU" is first canonicalised to "und-Armn-AM",
     24 // then the language is changed to "ru". If "ru" were applied first, the result
     25 // would be "ru-Armn-RU" instead.
     26 assert.sameValue(new Intl.Locale("und-Armn-SU", {language: "ru"}).toString(), "ru-Armn-AM");
     27 
     28 reportCompare(0, 0);