Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eda04d24c262500a374efe245de60fa7ed26da94
https://github.com/WebKit/WebKit/commit/eda04d24c262500a374efe245de60fa7ed26da94
Author: Chris Dumez <[email protected]>
Date: 2026-04-08 (Wed, 08 Apr 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-append-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-append.html
M Source/WebCore/dom/Node.cpp
Log Message:
-----------
ParentNode.append() should de-duplicate nodes when the same node is passed
multiple times
https://bugs.webkit.org/show_bug.cgi?id=311708
Reviewed by Ryosuke Niwa.
When the same node is passed multiple times to ParentNode.append() (e.g.,
append(x, y, x)),
convertNodesOrStringsIntoNodeVector() would produce a vector with duplicate
entries. This
caused a crash in appendChildCommon() which asserts that the node has no
parent, since the
first insertion already parented the node.
Fix by de-duplicating nodes in convertNodesOrStringsIntoNodeVector(), keeping
only the last
occurrence of each duplicate node. This matches the spec behavior as if a
temporary
DocumentFragment was used, and matches Blink and Gecko.
No new tests, covered by
imported/w3c/web-platform-tests/dom/nodes/ParentNode-append.html
which was resync'd from upstream to gain test coverage. This test is already
passing in
Chrome and Firefox so this aligns our behavior with them.
*
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-append-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/ParentNode-append.html:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::convertNodesOrStringsIntoNodeVector):
Canonical link: https://commits.webkit.org/310807@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications