Description
What is the issue with the DOM Standard?
WPT has tests such as the following: https://github.com/web-platform-tests/wpt/blob/856c33e87e61f513ddc81e082f78b6d24027e83d/dom/nodes/Document-createElementNS.js#L69
edit: These two tests also run into this issue:
- https://github.com/web-platform-tests/wpt/blob/master/dom/nodes/name-validation.html
- https://github.com/web-platform-tests/wpt/blob/master/dom/nodes/DOMImplementation-createDocument.html
Where qualified name in validate and extract (in this case, ":foo"
) ends up being something that begins with a colon.
As I understand, this means that when we strictly split that prefix on ":"
, splitResult[0]
ends up being the empty string, and localName
is foo
.
Therefore when we hit step 5.
- If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
Since prefix is the empty string, a DOMException is thrown as the empty string is not a valid namespace. Sidenote: This step also can result in "null" being passed into the AO which expects a string.
I can get all WPT tests passing if:
- If prefix is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
Is changed to:
- If prefix non-null and not the empty string and and is not a valid namespace prefix, then throw an "InvalidCharacterError" DOMException.
And:
- If prefix is non-null and namespace is null, then throw a "NamespaceError" DOMException.
Is changed to:
- If prefix is non-null and prefix is not the empty string and namespace is null, then throw a "NamespaceError" DOMException.