Bug 131074 - document.createElement() should always return an element in the HTML namespace
Summary: document.createElement() should always return an element in the HTML namespace
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-01 16:03 PDT by Daniel Bates
Modified: 2014-04-02 14:43 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2014-04-01 16:03:57 PDT
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>
Comment 1 Daniel Bates 2014-04-02 14:43:31 PDT
For completeness, I ran into this issue when merging a Blink patch in bug #131079.