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

> the only observable difference is what happens with unpaired surrogates.

Correct.

> it would seem odd for someone who is not aware of the nuances between DOMString and USVString to have a string downloaded from some JSON API unexpectedly throw an error transparently transformed

For what it’s worth, this is what the IETF says about unpaired surrogates in JSON:

https://tools.ietf.org/html/rfc8259#section-8.2
> Instances of this have been observed, for example, when a library truncates a UTF-16 string without checking whether the truncation split a surrogate pair. The behavior of software that receives JSON texts containing such values is unpredictable; for example, implementations might return different values for the length of a string value or even suffer fatal runtime exceptions.

In other words this is something that happens accidentally, and some other systems already go wrong when it does. It is already an error case, not meaningful content.

I think it is not useful to require new APIs to preserve these broken strings unchanged. (I’d argue that even doing for existing `DOMString` APIs is not useful, but that’s an argument for another time.)

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

Received on Friday, 23 February 2018 11:54:07 UTC