- From: James Browning <notifications@github.com>
- Date: Sun, 14 Dec 2025 23:26:33 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 15 December 2025 07:26:37 UTC
Jamesernator created an issue (whatwg/dom#1440)
### What is the issue with the DOM Standard?
From following the [adopt a node](https://dom.spec.whatwg.org/#concept-node-adopt) logic, as far I can tell the only thing that should happen for `.adoptNode(attr)` is that `attr.ownerDocument` is changed. However in all implementations adopting the node also results in the attribute being removed from the element:
```ts
const el = document.createElement("div");
el.setAttribute("foo", "bar");
const doc = new Document();
doc.adoptNode(el.attributes[0]);
// Prints undefined in all browsers
console.log(el.getAttribute("foo"));
```
The implementation behavior makes more sense as it would be strange for an attr to have a different owner document to it's owner element, however this needs some steps in the spec, either by changing [adopt a node](https://dom.spec.whatwg.org/#concept-node-adopt) to check if node is an `Attr` or perhaps by defining [*adopting steps*](https://dom.spec.whatwg.org/#concept-node-adopt-ext) for `Attr`.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1440
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/1440@github.com>
Received on Monday, 15 December 2025 07:26:37 UTC