Element.outerHTML is missing attribute prefixes in some cases in HTML documents
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 15:12:41 +0000 (15:12 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 15:12:41 +0000 (15:12 +0000)
commit8e1802ebc49092a7eb2e5bca5eeb962a21ae001f
treeca8a24ea502b74efad0588a3b081e945b1d622af
parent858daa7eb9c8db801553ac07654f8f7f09ab7c93
Element.outerHTML is missing attribute prefixes in some cases in HTML documents
https://bugs.webkit.org/show_bug.cgi?id=200283

Reviewed by Ryosuke Niwa.

Source/WebCore:

When HTML serializing a prefixed element attribute, we should always serialize the
prefix as per [1]. However, our code was only serializing the well-known ones (xml,
xmlns & xlink).

[1] https://html.spec.whatwg.org/#attribute's-serialised-name

Test: fast/dom/Element/outerHTML-prefixed-attribute.html

* editing/MarkupAccumulator.cpp:
(WebCore::htmlAttributeSerialization):
(WebCore::MarkupAccumulator::xmlAttributeSerialization):
(WebCore::MarkupAccumulator::appendAttribute):
* editing/MarkupAccumulator.h:

LayoutTests:

Add layout test coverage.

* fast/dom/Element/outerHTML-prefixed-attribute-expected.txt: Added.
* fast/dom/Element/outerHTML-prefixed-attribute.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248042 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/outerHTML-prefixed-attribute-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Element/outerHTML-prefixed-attribute.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/editing/MarkupAccumulator.cpp
Source/WebCore/editing/MarkupAccumulator.h