Closed Bug 9781 Opened 25 years ago Closed 25 years ago

CDATA sections become Text nodes

Categories

(Core :: DOM: Core & HTML, defect, P2)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: nisheeth_mozilla)

Details

CDATA sections are becoming Text nodes, when they should be CDATA nodes.
Furthermore, separate CDATA sections should (I'm 98% sure) be separate CDATA
nodes (should that be changed by normalize???).

I have tested CDATA sections in the following 2 tests, which may have
significant errors in them right now in the normalize() section, since they are
just copies of my Text tests:
http://www.fas.harvard.edu/~dbaron/dom/test/one-core-xml/CDATASection
http://www.fas.harvard.edu/~dbaron/dom/test/one-core-xml/CDATASection_2

In the first test, only the first test line is red.  This shows that the CDATA
section is being treated as a text node.

The greatly increased number of problems in the second test shows that the 2
CDATA sections are being treated as *one* text node.  They should be two CDATA
nodes.
I forgot to mention:  other problems in these tests are discussed in bug 9777,
bug 9778, and bug 9779.
The normalize() sections in the above tests are fixed.  The DOM1 spec
specifically says normalize() doesn't affect CDATA sections.
QA Contact: gerardok → ckritzer
Is this a DOM bug or a content-sink bug?
HTML DOM bugs are M11/P2 for Vidur.
Assignee: vidur → nisheeth
Passing along XML bugs to Nisheeth.
Status: NEW → ASSIGNED
Johnny Stenbeck (jst@citec.fi) has submitted a patch that fixes this.  I'm going
to check in his changes as soon as the tree opens.  We weren't creating CDATA
tokens in the tokenizer.  Now we do.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
The fix is checked in.  CCing Johnny.  Thanks a lot for the patch, Johnny.
Blocks: 17432
dbaron, would you verify this?  I've taken a quick peek @ the two test files you
put together (nice job, by the way) and I'd like to get your OK since you know
your test files better.
I'll try to remember to check five hours from now... the verification builds
don't hit mozilla.org until 2PM PDT = 5PM EDT = 5 hours 10 minutes away...
Status: RESOLVED → VERIFIED
OS: Linux → All
Target Milestone: M11 → M1
Verified fixed, since all tests are green - Linux apprunner 1999102808.
OS: All → Linux
Target Milestone: M1 → M11
Undoing seemingly random modifications.  I think it's a mozilla bug...
There were actually some bugs in my tests, and they weren't running to the end.
The bug is still fixed, though, but there's one (minor) new bug that was
uncovered... I'll file it later.
dbaron@fas.harvard.edu: Please CC me in the new bug (or file it against me).
Thank you.
The bug is actually a bug in Normalize().  See bug 9779.  I though Normalize()
was not implemented at all, but actually it does some stuff (not much), and it
does it to CDATA sections in addition to text nodes, because it checks the tag
name rather than the node type.  (I imagine that could mess up comments too...)
No longer blocks: 17432
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.