RESOLVED FIXED 5312
comments aren't available via DOM
https://bugs.webkit.org/show_bug.cgi?id=5312
Summary comments aren't available via DOM
Scott McDowell
Reported 2005-10-09 17:48:30 PDT
I was trying out a script that takes the nodeValue out of a comment tag. Here's a much simplified version that works in Mozilla, and not in Safari: <div id="whatanode"><!-- Here I Am --></div> <script> x = document.getElementById("whatanode").firstChild; document.write(x.nodeValue); // should print: Here I Am </script> When I view the DOM Tree in Safari, it seems all the comment tags aren't there. Are they even in the Webkit DOM?
Attachments
Test Case (204 bytes, text/html)
2005-10-09 17:51 PDT, Scott McDowell
no flags
Turns on comment nodes and fixes a few issues caused by it (34.04 KB, patch)
2006-07-08 20:54 PDT, Timothy Hatcher
no flags
New version that keeps documentElement const (31.03 KB, patch)
2006-07-08 21:11 PDT, Timothy Hatcher
mjs: review+
Scott McDowell
Comment 1 2005-10-09 17:51:30 PDT
Created attachment 4273 [details] Test Case In Mozilla, this code prints the string "Here I Am." In Safari, it fails.
Dave Hyatt
Comment 2 2005-10-09 18:09:58 PDT
They are not included for performance reasons. We do have a code path that will include the comments, but by default we deliberately omit them.
Joost de Valk (AlthA)
Comment 3 2006-02-06 11:46:35 PST
*** Bug 7104 has been marked as a duplicate of this bug. ***
James Brennan
Comment 4 2006-05-24 14:22:55 PDT
Dave, It's unclear whether you mean to address this bug or to leave it broken. Please clarify. Thanks! (In reply to comment #2) > They are not included for performance reasons. We do have a code path that > will include the comments, > but by default we deliberately omit them. >
Dave Hyatt
Comment 5 2006-05-25 18:22:33 PDT
We intend to fix. In fact I think we may already have.
David Kilzer (:ddkilzer)
Comment 6 2006-05-29 17:20:53 PDT
(In reply to comment #5) > We intend to fix. In fact I think we may already have. The comment node in the test case (Attachment 4273 [details]) does not appear in the Web Inspector as of WebKit r14619. See also Bug 9165 (which you may want to change to a duplicate of this bug).
Timothy Hatcher
Comment 7 2006-06-16 09:30:25 PDT
Timothy Hatcher
Comment 8 2006-07-08 20:54:43 PDT
Created attachment 9281 [details] Turns on comment nodes and fixes a few issues caused by it
Timothy Hatcher
Comment 9 2006-07-08 21:11:03 PDT
Created attachment 9282 [details] New version that keeps documentElement const Uses the mutable keyword on m_documentElement to keep documentElement() a const. This eliminates my earlier const changes.
Maciej Stachowiak
Comment 10 2006-07-09 00:40:59 PDT
Comment on attachment 9282 [details] New version that keeps documentElement const r=me
Timothy Hatcher
Comment 11 2006-07-09 00:51:37 PDT
Landed in r15247
Note You need to log in before you can comment on or make changes to this bug.