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

Make serialization scriptingEnabled-dependent #332

Closed
domenic opened this issue Mar 6, 2021 · 0 comments · Fixed by #383
Closed

Make serialization scriptingEnabled-dependent #332

domenic opened this issue Mar 6, 2021 · 0 comments · Fixed by #383

Comments

@domenic
Copy link

domenic commented Mar 6, 2021

https://html.spec.whatwg.org/#serialising-html-fragments says

If the parent of current node is a style, script, xmp, iframe, noembed, noframes, or plaintext element, or if the parent of current node is a noscript element and scripting is enabled for the node, then append the value of current node's data IDL attribute literally.

parse5 does not seem to implement this additional condition, and doesn't seem to even have the ability to tell the serializer about scripting-enabled or not:

if (
parentTn === $.STYLE ||
parentTn === $.SCRIPT ||
parentTn === $.XMP ||
parentTn === $.IFRAME ||
parentTn === $.NOEMBED ||
parentTn === $.NOFRAMES ||
parentTn === $.PLAINTEXT ||
parentTn === $.NOSCRIPT
) {
this.html += content;
} else {
this.html += Serializer.escapeString(content, false);
}

This is causing this web platform test to fail in jsdom.

fb55 added a commit to parse5/parse5-fork that referenced this issue Jan 18, 2022
@fb55 fb55 linked a pull request Jan 18, 2022 that will close this issue
fb55 added a commit to parse5/parse5-fork that referenced this issue Feb 7, 2022
@fb55 fb55 closed this as completed in #383 Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant