Bug 131074
| Summary: | document.createElement() should always return an element in the HTML namespace | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Daniel Bates <dbates> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, cdumez, rniwa |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Daniel Bates
According to <http://dom.spec.whatwg.org/#dom-document-createelement> (20 March 2014), document.createElement() should always return an element in the HTML namespace:
[[
The createElement(localName) method must run the these steps:
1. If localName does not match the Name production, throw an "InvalidCharacterError" exception.
2. If the context object is an HTML document, let localName be converted to ASCII lowercase.
3. Let interface be the element interface for localName and the HTML namespace.
4. Return a new element that implements interface, with no attributes, namespace set to the HTML namespace, local name set to localName, and node document set to the context object.
]]
At the time of writing, document.createElement() [1] returns an element in the HTML namespace for an XHTML document. Otherwise, it returns an element in the "null namespace".
[1] <http://trac.webkit.org/browser/trunk/Source/WebCore/dom/Document.cpp?rev=166600#L854>
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Daniel Bates
For completeness, I ran into this issue when merging a Blink patch in bug #131079.
Ahmad Saleem
rniwa@webkit.org - Is this something still needed or an issue? Thanks!
Alexey Proskuryakov
Running this in Web Inspector console for a HTML webpage, looks like this is fixed.
> document.createElement("a")
< <a></a>
> $1.namespaceURI
< "http://www.w3.org/1999/xhtml"
Ahmad Saleem
We have FIXME about this bug in here:
https://github.com/WebKit/WebKit/blob/main/LayoutTests/resources/js-test.js#L19
Should we modify our js-test.js script to update this?