Closed Bug 296657 Opened 19 years ago Closed 19 years ago

textContent outputs comment nodes

Categories

(Core :: DOM: Serializers, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jason.barnabe, Assigned: neil)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files)

DOM Core Level 3 says

"The string returned is made of the text content of this node depending on its
type, as defined below:

Node type:
ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
DOCUMENT_FRAGMENT_NODE

Content: concatenation of the textContent attribute value of every child node,
*excluding COMMENT_NODE* and PROCESSING_INSTRUCTION_NODE nodes. This is the
empty string if the node has no children."

We're not exluding comment nodes.
Attached file testcase
Is this a regression from bug 285830?
Blocks: 285830
Flags: blocking1.8b3?
Oops :-[

bz, should I a) call IsContentTypeOf(eTEXT) and cast to nsITextContent, b) QI to
nsITextContent and call IsContentTypeOf(eTEXT) or c) something else?
Keywords: regression
b). Though do the IsContentOfType test first to avoid unneccesary QIs.
Remember that .textContent on a comment itself should return the text, just that
a parent of a comment should not include the comment. As described here:

   http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
What sicking said.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Belt and bracesSplinter Review
Assignee: dom-to-text → neil.parkwaycc.co.uk
Status: NEW → ASSIGNED
Attachment #185410 - Flags: superreview?(jst)
Attachment #185410 - Flags: review?(bugmail)
Comment on attachment 185410 [details] [diff] [review]
Belt and braces

sr=jst
Attachment #185410 - Flags: superreview?(jst) → superreview+
Comment on attachment 185410 [details] [diff] [review]
Belt and braces

seeking approval for regression fix.
Attachment #185410 - Flags: approval1.8b3?
Attachment #185410 - Flags: approval1.8b3? → approval1.8b3+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: blocking1.8b3?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: