whatwg / dom

DOM Standard
https://dom.spec.whatwg.org/
Other
1.56k stars 289 forks source link

How looks converting a string to ASCII uppercase/lowercase for other Unicode characters? #159

Closed ArkadiuszMichalski closed 8 years ago

ArkadiuszMichalski commented 8 years ago

Whe have two def: https://dom.spec.whatwg.org/#converted-to-ascii-uppercase https://dom.spec.whatwg.org/#converted-to-ascii-lowercase but it only covers ASCII characters. What should be done if we use in some methods other characters, like Ś, Ź, Ć. Ż, etc.?

For example, "converted to ASCII lowercase" is used in "list of elements with qualified name qualifiedName", createElement() createAttribute(), and other attr stuff, where we can pass not only Ascii characters. Using this definitiona doesn't suggest that conversion is making only for Ascii characters?

Edit: Hmm interesting, Firefox convert only ASCII, but Chrome all characters:

<script>
    var el1 = document.createElement("TEST:ŚĆŹ");
    console.log(el1.localName); //  Firefox "test:ŚĆŹ", Chorme "test:śćź"
    console.log(el1.tagName); // Firefox "TEST:ŚĆŹ", Chrome "TEST:ŚĆŹ"

    var el2 = document.createElementNS("http://www.w3.org/1999/xhtml", "test:śćź");
    console.log(el2.localName); //  Firefox and Chorme "śćź"
    console.log(el2.tagName); // Firefox "TEST:śćź", Chrome "TEST:ŚĆŹ"
</script>

IE11 throw when try pass non-ASCII to createElement()/createElementNS(). What Edge does?

annevk commented 8 years ago

It is clear what the behavior should be. Not all browsers might implement this consistently, but those are best filed as bugs.