haikuwebkit/LayoutTests/fast/dom/set-outer-html-special-case...

14 lines
567 B
Plaintext
Raw Permalink Normal View History

Relax "parent must be an HTMLElement" restriction in outerHTML setter https://bugs.webkit.org/show_bug.cgi?id=226808 Reviewed by Ryosuke Niwa. Source/WebCore: Made the following change to our outerHTML setter for better compatibility and to better match the specification [1]: - Stop throwing an exception when the parent is not an HTML element. This new behavior matches the specification, Blink and Gecko behavior. I did not fully align us with the specification because we are mostly aligned with Blink at the moment. In particular: - The specification says the outerHTML setter should be a no-op when the parent is null. Firefox matches the specification but WebKit & Blink throw a NoModificationAllowedError. - The specification says we should allow setting outerHTML if the parent is a DocumentFragment. Firefox allows this but WebKit & Blink throw a NoModificationAllowedError. - WebKit & Blink have some Text node merging logic that is not present in the specification and which Gecko doesn't implement. [1] https://w3c.github.io/DOM-Parsing/#dom-element-outerhtml Test: fast/dom/set-outer-html-special-cases.html * dom/Element.cpp: (WebCore::Element::setOuterHTML): LayoutTests: * fast/dom/set-outer-html-special-cases-expected.txt: Added. * fast/dom/set-outer-html-special-cases.html: Added. Add layout test coverage * fast/dynamic/outerHTML-no-element-expected.txt: Rebaseline test due to different exception message. * platform/mac-wk1/imported/w3c/web-platform-tests/mathml/relations/css-styling/padding-border-margin/margin-003-expected.txt: * platform/mac-wk2/imported/w3c/web-platform-tests/mathml/relations/css-styling/padding-border-margin/margin-003-expected.txt: Rebaseline WPT test. This is actually a progression because we're no longer throwing. However, the test is still failing later on. Canonical link: https://commits.webkit.org/238774@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-13 19:16:48 +00:00
Tests some special cases of the outerHTML setter.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.getElementById('svgElement').innerHTML is "<g></g>"
PASS document.documentElement.outerHTML = '' threw exception NoModificationAllowedError: Cannot set outerHTML on element because its parent is not an Element.
PASS a.parentNode is null
PASS a.outerHTML = '' threw exception NoModificationAllowedError: Cannot set outerHTML on element because it doesn't have a parent.
PASS successfullyParsed is true
TEST COMPLETE