Replies: 0 comments 3 replies
-
Big +1 👍 I strongly support making this change. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
DOMString
,ByteString
andUSVString
are defined by Web IDL as strings with varying restrictions, whileCSSOMString
is defined as eitherDOMString
orUSVString
, to allow for implementations that use either UTF-8 or UTF-16 internally.From the perspective of JavaScript and web developers, there are just strings:
DOMString
is just aString
by another name.ByteString
has the additional requirement that no code point is larger than 255 and is used mainly for HTTP headers. The following throws aTypeError
because of this:USVString
has the additional requirement that there are no lone surrogates, and is used a lot for URLs. Lone surrogates are replaced with U+FFFD in APIs that accept USVString.CSSOMString
is just a type alias, so it might behave likeUSVString
, or it might not.These distinctions rarely matter, and I'm proposing that MDN simply talks about strings in most cases.
Aside: There's an unfortunate number of references to "DOMString objects", "USVString object", etc. There aren't objects, they're strings :)
Beta Was this translation helpful? Give feedback.
All reactions