-
Notifications
You must be signed in to change notification settings - Fork 14
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
Attribute value serialization does not take whitespace normalization into account #59
Labels
Comments
This also matches the behavior in https://github.com/jsdom/w3c-xmlserializer/blob/master/lib/attributes.js#L29 |
wmfgerrit
pushed a commit
to wikimedia/mediawiki-libs-Dodo
that referenced
this issue
Jul 3, 2021
Bug: w3c/DOM-Parsing#29 Bug: w3c/DOM-Parsing#38 Bug: w3c/DOM-Parsing#47 Bug: w3c/DOM-Parsing#48 Bug: w3c/DOM-Parsing#50 Bug: w3c/DOM-Parsing#52 Bug: w3c/DOM-Parsing#59 Bug: w3c/DOM-Parsing#71 Change-Id: I76735c4be1d9738c690417207301f737e3a3c9ff
webkit-commit-queue
pushed a commit
to WebKit/WebKit
that referenced
this issue
Jul 11, 2021
https://bugs.webkit.org/show_bug.cgi?id=227844 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebaseline WPT test now that one more subtest is passing. * web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt: Source/WebCore: XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t. This is causing the "check XMLSerializer.serializeToString escapes attribute values for roundtripping" subtest to fail in WebKit on: http://wpt.live/domparsing/XMLSerializer-serializeToString.html Chrome and Firefox both escape these and pass this WPT subtest. The specification does not indicate we should escape those: - https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value But there is an open bug about this: - w3c/DOM-Parsing#59 No new tests, rebaselined existing test. * editing/MarkupAccumulator.cpp: (WebCore::elementCannotHaveEndTag): * editing/MarkupAccumulator.h: Canonical link: https://commits.webkit.org/239576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bertogg
pushed a commit
to Igalia/webkit
that referenced
this issue
Jul 12, 2021
https://bugs.webkit.org/show_bug.cgi?id=227844 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebaseline WPT test now that one more subtest is passing. * web-platform-tests/domparsing/XMLSerializer-serializeToString-expected.txt: Source/WebCore: XMLSerializer.serializeToString() doesn't properly escape \n, \n and \t. This is causing the "check XMLSerializer.serializeToString escapes attribute values for roundtripping" subtest to fail in WebKit on: http://wpt.live/domparsing/XMLSerializer-serializeToString.html Chrome and Firefox both escape these and pass this WPT subtest. The specification does not indicate we should escape those: - https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value But there is an open bug about this: - w3c/DOM-Parsing#59 No new tests, rebaselined existing test. * editing/MarkupAccumulator.cpp: (WebCore::elementCannotHaveEndTag): * editing/MarkupAccumulator.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@279815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The steps for "to serialize an attribute value" only escape the characters
"
,&
,<
and>
in the attribute value. White space characters are passed through to the serialization as-is. However, XML processors will replace each space, tab, carriage return or line feed character with a space according to https://www.w3.org/TR/xml11/#AVNormalize unless the character was present as a character reference. It seems therefore that the attribute value serialization algorithm should include a step mapping tab to	
, carriage return to
and line feed to

.Testing this in various browsers shows that these already apply a similar substitution:
The algorithm as described in this specification would generate
<root attr=" \t\r\n"/>
(where\t
\r
and\n
represent tab, carriage return and line feed respectively). Only Safari seems to follow the specification here. Unfortunately, this serialization does not survive a round-trip, as it is normalized to four spaces by processors such as the DOMParser:The text was updated successfully, but these errors were encountered: