Skip to content

Commit

Permalink
Add test that adopting an element into a new doc updates the attribut…
Browse files Browse the repository at this point in the history
…e' owner docs

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
  • Loading branch information
simonwuelker authored and servo-wpt-sync committed Jan 19, 2025
1 parent 8f3f629 commit 7a107dd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dom/nodes/Node-mutation-adoptNode.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@
assert_equals(div.firstChild.ownerDocument, document);
}, "simple append of foreign div with text");

test(function() {
var div = document.createElement("div");
div.id = "foobar";

assert_equals(div.ownerDocument, document);
assert_equals(div.attributes[0].ownerDocument, document);

var other_doc = document.implementation.createHTMLDocument();
other_doc.body.appendChild(div);

assert_equals(div.ownerDocument, other_doc);
assert_equals(div.attributes[0].ownerDocument, other_doc);
}, "Adopting an element into a different document update's the element's owner doc as well as the owner docs of it's attributes")

</script>

0 comments on commit 7a107dd

Please sign in to comment.