[whatwg/dom] When cloning a custom element, `element.outerHTML !== element.cloneNode().outerHTML` appears (#922)

example:

```js
class AppElement extends HTMLElement {
  constructor(appTitle) {
    super();
    Object.defineProperty(this, "appTitle", {
      set(v) {
        if (v) {
          this.setAttribute("app-title", v);
        } else {
          console.log(
            "Attribute has been cloned:",
            this.hasAttribute("app-title")
          );
          this.removeAttribute("app-title");
        }
      }
    });
    this.appTitle = appTitle;
  }
}
customElements.define("app-root", AppElement);
const app = new AppElement("title");

console.log(app.outerHTML === app.cloneNode().outerHTML);
```
[CodeSandbox](https://codesandbox.io/s/muddy-tdd-r8zno?file=/src/index.js)

I read [this](https://dom.spec.whatwg.org/#concept-node-clone-ext), it should be `true` if you create the element first and then copy the attribute


-- 
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/922

Received on Tuesday, 10 November 2020 23:02:08 UTC