Re: [css-houdini-drafts] Should we be using DOMString, USVString, or CSSOMString?

Stated another way: if we were to just use DOMString (i.e., the normal JS string type) throughout the platform, then the first step of all the URL APIs would be "Let _thingToProcess_ be the result of converting _arg_ to a sequence of scalar values." This is because URL APIs then feed into a number of algorithms that operate on the individual scalar values (e.g., percent encoding/decoding).

USVString is just a convenient way to save typing out that step over and over.

For APIs who don't internally call into algorithms that operate on scalar values, but instead just operate on un-interpreted strings, you would never write that preprocessing step, with all of its associated costs. So such APIs should just use DOMStrings, and not add the additional preprocessing that USVStrings bring along.

-- 
GitHub Notification of comment by domenic
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/687#issuecomment-367769195 using your GitHub account

Received on Thursday, 22 February 2018 18:18:10 UTC