Skip to content
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

[cssom] U+0000 does not need to be replaced when serializing an identifier #8074

Closed
cdoublev opened this issue Nov 15, 2022 · 2 comments
Closed
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. cssom-1 Current Work

Comments

@cdoublev
Copy link
Collaborator

I think that U+0000 does not need to be replaced in serialize an identifier.

To serialize an identifier means to create a string represented by the concatenation of, for each character of the identifier:

  • If the character is NULL (U+0000), then the REPLACEMENT CHARACTER (U+FFFD).
  • [...]

The examples below the definition of CSS.escape() use it in document.querySelector() but this method parses its input with parse a selector, which leads to replacing U+0000 with U+FFFD in filter code points.

@Loirooriol
Copy link
Contributor

I think Typed OM can avoid "filter code points":

var v = new CSSKeywordValue("a\u0000b");
v.value; // "a\u0000b"
v.toString(); // "a�b"

@cdoublev
Copy link
Collaborator Author

I think Typed OM can avoid "filter code points" [when creating new CSSKeywordValue("a\u0000b")]

I cannot find where it is defined in CSS Typed OM, that CSSKeywordValue.toString() uses serialize an identifier.

However I recently learned that CSSKeyframesRule.name is supposed to accept any non-empty input (#9363), unlike animation-name, which is restricted to custom idenfiers and strings, and CSSOM uses serialize an identifier to serialize CSSKeyframesRule.name while serializing CSSKeyframesRule.cssText.

The bottom line is that serialize an identifier also replaces U+0000, for convenience, to serialize a user input specified via JS and that was not parsed as a CSS value, therefore I am closing this issue.

@cdoublev cdoublev added the Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. cssom-1 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants