[whatwg/dom] createElement() does not put things in the HTML namespace correctly (#643)

https://dom.spec.whatwg.org/commit-snapshots/4b2633f0b79aa4b49245e6a5022baf6a2b5dffe6/#example-5ffcda00

> Let namespace be the HTML namespace, if the context object is an HTML document or context object’s content type is "application/xhtml\+xml", and null otherwise\. 

Consider the following code:

```js
const doc = new Document();
const a = document.createElement("a");
console.log(a.constructor.name);
```

This logs `HTMLAnchorElement` in all browsers.

However, per spec this should log `Element`. `new Document()` creates a new XML document, with content-type application/xml. So createElement() should use the null namespace. So when you go to look up the element interface to use, you just get the default, Element.

This seems to have been changed previously:

- https://github.com/whatwg/dom/issues/264
- https://github.com/whatwg/dom/pull/213
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=19431

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

Received on Sunday, 29 April 2018 23:47:05 UTC