Repository navigation
Adopt an attribute into the document it is set on - #4245
Conversation
Setting an attribute node on an element in another document left the attribute pointing at its old node document, and adopting an element only updated the element itself, not the attributes in its attribute list. Co-authored-by: Claude Opus 5 <[email protected]>
| throw DOMException.create(element._globalObject, ["The attribute is in use.", "InUseAttributeError"]); | ||
| } | ||
|
|
||
| element._ownerDocument._adoptNode(attr); |
There was a problem hiding this comment.
This does not appear in the spec.
Instead, the spec has steps which jsdom appears to be missing in https://dom.spec.whatwg.org/#concept-element-attributes-replace and https://dom.spec.whatwg.org/#concept-element-attributes-append .`
Append and replace each set the attribute's node document to the element's, rather than adopting it in "set an attribute". Co-authored-by: Claude Opus 5 <[email protected]>
|
You're right, thanks — I had invented an adopt step in "set an attribute" instead of implementing what's actually written. Fixed. "Append an attribute" step 3 and "replace an attribute" step 4 both say to set the attribute's node document to the element's node document, so it's a plain assignment in those two, not The other half of the change does appear in the adopt algorithm, so I've kept it:
|
|
@copilot resolve the merge conflicts in this pull request |
Two places where an attribute kept pointing at the wrong node document.
"Set an attribute" is missing its adopt step, so
setNamedItemwith an attribute from another document leftattr.ownerDocumenton the old one. And_adoptNodeset the node document of every shadow-including inclusive descendant but not of the attributes in each element's attribute list, which the adopt algorithm also asks for.Removes two entries from
to-run.yaml:attributes-namednodemap-cross-document.window.htmland theNode-mutation-adoptNode.htmlsub-test.Motivation: still working through the failures recorded in
to-run.yamlrather than hitting this in an application.