[Webkit-unassigned] [Bug 126605] DOM serialization: < and > should not be quoted in HTML attribute values

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 8 10:37:39 PST 2014


https://bugs.webkit.org/show_bug.cgi?id=126605





--- Comment #4 from Victor Costan <costan at gmail.com>  2014-01-08 10:35:23 PST ---
(In reply to comment #3)
> (From update of attachment 220575 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=220575&action=review
> 
> > Source/WebCore/ChangeLog:10
> > +        * editing/MarkupAccumulator.h: EntityMaskInHTMLAttributeValue matches DOM spec.
> 
> Is this actually the only place where XMLSerializer does not match the "specification" for HTML documents? I thought it didn't care whether it's HTML or XML, unlike in Firefox.

To the best of my understanding, MarkupAccumulator is used indirectly by Element.innerHTML and Element.outerHTML too.

HTMLElement::{innerHTML, outerHTML} (WebCore/html/HTMLElement.cpp) ->
    WebCore::createMarkup (WebCore/editing/markup.cpp) ->
    WebCore::createMarkupInternal (WebCore/editing/markup.cpp) ->
    StyledMarkupAccumulator::serializeNodes (WebCore/editing/markup.cpp) ->
    StyledMarkupAccumulator::traverseNodesForSerialization (WebCore/editing/markup.cpp) ->
    MarkupAccumulator::appendStartTag (WebCore/editing/MarkupAccumulator.cpp) -> 
    MarkupAccumulator::appendStartMarkup (WebCore/editing/MarkupAccumulator.cpp) -> 
    StyledMarkupAccumulator::appendElement (WebCore/editing/markup.cpp) -> 
    MarkupAccumulator::appendElement (WebCore/editing/MarkupAccumulator.cpp) -> 
    MarkupAccumulator::appendAttribute (WebCore/editing/MarkupAccumulator.cpp) -> 
    MarkupAccumulator::appendAttributeValue (WebCore/editing/MarkupAccumulator.cpp)

MarkupAccumulator::appendAttributeValue is where the mask is chosen, depending on the document type. So changing the mask does impact the serialization of HTML documents.

Also, the new layout test that I added shows that either I'm right, or there's another code path that I don't see which uses the same mask. "git grep" tells me the mask name isn't referenced anywhere in WebCore, so I'm reasonably certain that I got this right.

> 
> > LayoutTests/fast/dom/dom-parse-serialize.html:43
> > +    '<?xml version="1.0"?>\n<!DOCTYPE doc [\n<!ATTLIST d id ID #IMPLIED>\n]>\n<doc>\n  <foo xmlns="foobar">One</foo> <x:bar xmlns:x="barfoo">Two</x:bar>\n  <d id="id3">Three</d>\n<f id="&amp;&lt;&gt;>">Four&amp;&lt;&gt;</f><empty/><empty></empty></doc>\n';
> 
> It's confusing that this change for how HTML is serialized includes a change to an XML test.

I added that because I wanted to make sure that > can be read from an XML attribute in both its un-escaped and escaped form (&gt;) and it always comes out as &gt; I didn't see this covered in other tests. I thought it's a useful check, from a black-box testing perspective. I can remove it if you disagree.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list