[whatwg/dom] `cloneNode` should preserve element prototype (#565)

At the moment `cloneNode` acts like creating new element with the same name and then recursively copying attributes / chidlren from source to new target. This doesn't live up to its meaning as prototype of the cloned node is not preserved.

Test:

```js
const customProto = Object.create(HTMLElement.prototype, {
  value: {
    set(v) { this._value = v; },
    get() { this._v; }
  }
});

const a = document.createElement('a');
Object.setPrototypeOf(a, customProto);

const b = a.cloneNode(true /* This doesn't matter */);
customProto.isPrototypeOf(b) === false; // <-- true
```

Tests - clone node preserving prototype:

* [x] Chrome
* [ ] IE11
* [ ] Firefox
* [ ] Edge



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/565

Received on Saturday, 27 January 2018 11:27:39 UTC