Closed
Bug 1150991
Opened 9 years ago
Closed 9 years ago
createComment lets you create comments containing '-->' which don't round-trip
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: roan.kattouw, Unassigned)
References
(Depends on 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150321175551 Steps to reproduce: > div = document.createElement( 'div' ); > div.appendChild( document.createComment( 'Foo-->bar' ) ); > div.childNodes; NodeList [ <!-- Foo-->bar --> ] > div.innerHTML; "<!--Foo-->bar-->" > div.innerHTML = div.innerHTML; > div.childNodes NodeList [ <!-- Foo -->, #text "bar-->" ] Actual results: I was allowed to create a comment that contained '-->' , and this triggered a round-trip failure. Expected results: I possibly should not be allowed to create a comment containing '-->' (there used to be an exception thrown for '--' but that was removed per spec, see https://bugzilla.mozilla.org/show_bug.cgi?id=412257 ). I definitely should not be able to create DOMs that don't round-trip.
Reporter | ||
Comment 1•9 years ago
|
||
This seems to be a bug in the spec rather than in Firefox specifically: the same behavior happens in Chrome 41 and IE 11.
Blocks: innerhtml-roundtrip
Reporter | ||
Comment 2•9 years ago
|
||
Corresponding bug report in Chrome: https://code.google.com/p/chromium/issues/detail?id=473767
Comment 3•9 years ago
|
||
Thanks for the report! This is essentially the same as bug 974212, but the description in that bug is not as clear as in this one, for me to be completely sure.
Comment 4•9 years ago
|
||
> I definitely should not be able to create DOMs that don't round-trip.
That's completely infeasible in HTML. For example, you can append kids to an <img> element, which won't round-trip when serialized and parsed as HTML (not XHTML).
In any case, we're just following the spec here. If you think the spec should change, you should probably raise a spec issue, not bug reports on browsers.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•