[Webkit-unassigned] [Bug 249737] Setting outerHTML on child of DocumentFragment throws error
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Dec 22 22:57:04 PST 2022
https://bugs.webkit.org/show_bug.cgi?id=249737
Karl Dubost <karlcow at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |karlcow at apple.com
See Also| |https://bugs.webkit.org/sho
| |w_bug.cgi?id=226808
--- Comment #1 from Karl Dubost <karlcow at apple.com> ---
Blink error:
> Uncaught DOMException: Failed to set the 'outerHTML' property on 'Element': This element's parent is of type '#document-fragment', which is not an element node.
> at <anonymous>:1:31
WebKit error:
> nomodificationallowederror: Cannot set outerHTML on element because its parent is not an Element
Firefox returns:
''
https://searchfox.org/wubkat/rev/9ced63bbda6ac9231451b1ca549a16f397e28c78/Source/WebCore/dom/Element.cpp#3554-3589
```
ExceptionOr<void> Element::setOuterHTML(const String& html)
{
// The specification allows setting outerHTML on an Element whose parent is a DocumentFragment and Gecko supports this.
// However, as of June 2021, Blink matches our behavior and throws a NoModificationAllowedError for non-Element parents.
RefPtr parent = parentElement();
if (UNLIKELY(!parent)) {
if (!parentNode())
return Exception { NoModificationAllowedError, "Cannot set outerHTML on element because it doesn't have a parent"_s };
return Exception { NoModificationAllowedError, "Cannot set outerHTML on element because its parent is not an Element"_s };
}
// … cut for brevity
}
```
This was added by Chris Dumez in June 2021
https://bugs.webkit.org/show_bug.cgi?id=226808
https://github.com/WebKit/WebKit/commit/dc33e397532ef8140d9e3fa80b7723e16b863746
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221223/95bbdaeb/attachment-0001.htm>
More information about the webkit-unassigned
mailing list