-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide clearer advice about USVString vs. DOMString #84
Comments
The plan is to rephrase this in terms of https://infra.spec.whatwg.org/#strings and use JavaScript (for DOMString) and scalar value string (for USVString) from there. Is the difference sufficiently clear there? |
No, it specifically calls out UTF-8 encode as a place where USVString applies. I haven't really countered another place, though the source does mention Rust subsystems as something where this might make sense, but since Rust isn't used on a large scale that's not super relevant yet. |
So concretely, I think we should point out that USVString should be used for URLs or for strings that are to be sent "over the wire". I'm not sure what other scenarios there might be. |
For what it’s worth, Firefox’s ongoing style system rewrite uses UTF-8 strings internally. This effectively makes CSSOM strings be |
Right... I don't think we want to propogate such implementation-specific quirks throughout the platform via Web IDL advice. |
Right, |
This patch adjusts `ScriptURLString` to be a union including `USVString`, not `DOMString`. The advice in [WebIDL][1] isn't exactly clear, but it boils down to @domenic's notes in [whatwg/webidl#84][2] and [w3ctag/design-principles#93][3]. Long story short, URLs are `USVString`. This patch adjusts our implementation to match. [1]: https://heycam.github.io/webidl/#idl-USVString [2]: whatwg/webidl#84 (comment) [3]: w3ctag/design-principles#93 (comment) Change-Id: I9bf1240b421287d7d9c291b13d887ca981a66231
This patch adjusts `ScriptURLString` to be a union including `USVString`, not `DOMString`. The advice in [WebIDL][1] isn't exactly clear, but it boils down to @domenic's notes in [whatwg/webidl#84][2] and [w3ctag/design-principles#93][3]. Long story short, URLs are `USVString`. This patch adjusts our implementation to match. [1]: https://heycam.github.io/webidl/#idl-USVString [2]: whatwg/webidl#84 (comment) [3]: w3ctag/design-principles#93 (comment) Change-Id: I9bf1240b421287d7d9c291b13d887ca981a66231
Is https://w3ctag.github.io/design-principles/#idl-string-types a sufficient fix for this? |
I believe so. We might have just forgot to close this. |
In w3ctag/design-reviews#87 (comment) (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:
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 w3ctag/design-reviews#87 (comment)
This seems like an area where giving clear and consistent advice is important.
The text was updated successfully, but these errors were encountered: