Closed
Bug 503210
Opened 16 years ago
Closed 15 years ago
Relax createElement tag name requirements to match HTML5 parser
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: jruderman, Unassigned)
Details
Entering
javascript:alert(document.createElement("a<b"))
gives
NS_ERROR_DOM_INVALID_CHARACTER_ERR: String contains an invalid character
but the HTML5 parser is happy to create such an element. I think createElement should be changed to match.
Reporter | ||
Updated•16 years ago
|
Summary: Relax createElement tag name requirements to match HTML5 → Relax createElement tag name requirements to match HTML5 parser
Comment 1•16 years ago
|
||
Is that a bug in HTML5 parser or could we perhaps change HTML5 spec to not allow that?
What would be the reason to allow "a<b" elements?
Comment 2•15 years ago
|
||
The DOM specifications are very clear here, and there's no reason to break them.
Status: NEW → RESOLVED
Closed: 15 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → INVALID
Reporter | ||
Comment 3•15 years ago
|
||
The reason to allow it is that anything that the HTML5 parser can create, you should be able to create with createElement. Changing the HTML5 parser instead would probably make more sense.
Comment 4•15 years ago
|
||
(In reply to comment #3)
> The reason to allow it is that anything that the HTML5 parser can create, you
> should be able to create with createElement.
Why, though? (Not a rhetorical question; I'd really like to know.)
> Changing the HTML5 parser instead would probably make more sense.
That's bug 510252.
Reporter | ||
Comment 5•15 years ago
|
||
It's already annoying enough that not every document can be serialized to HTML or XML. Making it so some documents cannot be serialized as scripts would break my mind.
Comment 6•15 years ago
|
||
That was already possible with the old parser. See this example: <http://software.hixie.ch/utilities/js/live-dom-viewer/saved/395> (that's U+00D7).
Reporter | ||
Comment 7•15 years ago
|
||
You left out the appendChild call. But yeah, you're right.
<!DOCTYPE html>
<body>...
<a×>
<script>
document.body.appendChild(document.createElement("a×"));
</script>
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•