Closed
Bug 144901
Opened 23 years ago
Closed 15 years ago
Comment node should not include comment delimiters
Categories
(Core :: DOM: HTML Parser, defect)
Core
DOM: HTML Parser
Tracking
()
RESOLVED
WONTFIX
Future
People
(Reporter: hjtoi-bugzilla, Unassigned)
Details
(Whiteboard: Ignore comments 5,6,10-15)
Attachments
(2 files)
If you have a comment like:
<!-- Foo -- -- bar -->
we currently create a DOM node with text: " Foo -- -- bar ". Arguably the text
should be: " Foo bar ".
![]() |
||
Comment 1•23 years ago
|
||
We want to be able to serialize back out, though.... what about:
<!DOCTYPE -- this is text -- HTML PUBLIC ....>
Or even <!-- text -- FOO -- text -->
(I realize the second of these has some issues.....)
Comment 2•23 years ago
|
||
From the DOM1 spec: Interface Comment
This represents the content of a comment, i.e., all the characters between
the starting '<!--' and ending '-->'. Note that this is the definition of a
comment in XML, and, in practice, HTML, although some HTML tools may implement
the full SGML comment structure. So I think, regrettably, that a "dumb" (i.e.,
non-SGML) interpretation is correct for comments within a comment declaration.
As we currently parse HTML, we don't yet recognize comments in doctypes; I don't
know what we do for XML (although even in DOM3, the documentType interface is
fairly crude, and does not provide enough information to completely recreate an
internal DTD subset from the DOM).
Ultimately, the DOM WG's decision to address HTML as if it were just an
extension of the XML DOM Core, and not a SGML application, is at the root of
these difficulties.
Comment 3•19 years ago
|
||
We should be compatible with Opera:
http://weblog.timaltman.com/node/798#comment-869
The question is which browser should change. :-) Any ideas?
Assignee: harishd → mrbkap
Status: ASSIGNED → NEW
QA Contact: moied → parser
![]() |
||
Comment 4•19 years ago
|
||
As I said, any change to our code here would have to handle serialization properly...
I was going to file a bugreport but this one seems to be sort of the same. Pieces of markup can drown between comment tags unwillingly. See the testcase.
![]() |
||
Comment 6•19 years ago
|
||
The behavior on the testcase in comment 5 is correct. Sander, please go read up on SGML comment syntax and see the HTML spec's section on comments (and please don't comment on this bug with the results, since the whole thing has nothing to do with this bug).
Whiteboard: Ignore comments 5 and 6
Comment 7•19 years ago
|
||
Comment dashing Bug
SHORT:
if any of the html-comments contains more than five dashes, parser skips some of the subsequent html-code. if however the amount is less than six dashes the parsing works fine.
USAGE:
* just open this html-document in your browser.
* everything should be fine, watch the coloured page-source.
* change the amount of dashes in a comment.
i.e. increase them to contain a sequence of at least six dashes instead of five.
* reload the document and see.
VERIFIED:
* Firefox 1.0.7 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051010 Firefox/1.0.7 (Ubuntu package 1.0.7)
* Mozilla 1.8b2 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050702
* Minefield 3.0a1 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060524 Minefield/3.0a1
* SeaMonkey 1.5a Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060519 SeaMonkey/1.5a
Comment 9•19 years ago
|
||
Look at what the w3c validator does if it encounters no DTD, it fallsback to HTML 4.01 Transitional.
This bug persists regardless of doctype or xml declaration. It can expose comments or hide large chunks of html between comments.
I think if a doctype is given then gecko should respect the comment syntax of the xml.
Comment 10•16 years ago
|
||
Okay
Is this right? This bug has been know by Mozilla for THREE YEARS, and nothing has been fixed?
I wasted 3 hours today, trying to figure out why my website works fine on Webkit, IE, Opera, etc, but NOT on Firefox.
Why isnt this bug fixed?
Thanks
William
![]() |
||
Comment 11•16 years ago
|
||
Because it's not clear that it's a bug, or what the fix should be if it is. Can you actually point to a spec that says what the behavior should be?
That said, I suspect you are not in fact seeing this bug; or are you really examining the content of Comment nodes in the DOM?
Comment 12•16 years ago
|
||
Boris, thanks.
When I do: View > Page Source...
on both Mac and PC Windows XP
<!-- Dummies ---
some javascript code here
-->
I see commented code which is green, and then in the middle of the commented code, the code suddenly becomes color-coded as active.
Removing the three dashes after "Dummies" fixes the bug in Firefox on my website.
So, yes, seems to fit with the bug description first reported over four years ago!
![]() |
||
Comment 13•16 years ago
|
||
Actually, that has nothing whatsoever to do with this bug. What you're seeing there is that you have a comment which is malformed per HTML4 spec (unlike the comment described in comment 0 of this bug, which is just fine; the number of dashes matters), and that at this point Gecko is the only browser engine that actually tries to follow the HTML4 spec for comment parsing. The proposed HTML5 draft changes how comments get parsed. You might be interested in reading bug 214476 for the details.
In general, it's worth making sure you really understand the issues before shouting (which is what all caps typically means) about "three years" and so forth...
Whiteboard: Ignore comments 5 and 6 → Ignore comments 5,6,10-13
Comment 14•16 years ago
|
||
Thanks for your reply, and the reference.
Note:
None of the other browsers show this bad behaviour, regardless of the spec.
Text inside comments *should* behave in a predictable manner, and if it doesn't, it's sure to cause trouble.
The "responsible" Standards committee members should behave rationally and considerately, not arrogantly and arbitrarily.
I've been programing for 40 years now, btw.
![]() |
||
Comment 15•16 years ago
|
||
Yes, but the issue in your case is the definition of "inside" comments. "--" is the comment delimiter in HTML4. Really, see bug 214476. None of that has to do with this bug, though now the comments about it make up 1/3 of the comments here....
Whiteboard: Ignore comments 5,6,10-13 → Ignore comments 5,6,10-15
Updated•16 years ago
|
Assignee: mrbkap → nobody
Comment 16•15 years ago
|
||
WONTFIX per HTML5 spec.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•