[webidl] provide clearer advice about USVString vs. DOMString (#84)

In https://github.com/w3ctag/spec-reviews/issues/87#issuecomment-171535440 (see also the following comment) we had a brief discussion about USVString vs. DOMString.  This seems like a somewhat tricky (in that it's easy to get wrong) API design issue, and the current wording in WebIDL isn't particularly clear.

http://heycam.github.io/webidl/#idl-USVString currently says:
> Specifications SHOULD only use USVString for APIs that perform text processing and need a string of Unicode scalar values to operate on. Most APIs that use strings should instead be using DOMString, which does not make any interpretations of the code units in the string. When in doubt, use DOMString.

This is a bit unclear in a few ways (not clear what "text processing" means; does encoding conversion count?), and doesn't seem to match the other advice being given, e.g., in https://github.com/w3ctag/spec-reviews/issues/87#issuecomment-171575546

This seems like an area where giving clear and consistent advice is important.

---
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/84

Received on Thursday, 14 January 2016 22:29:27 UTC