- From: Norman Walsh <ndw@nwalsh.com>
- Date: Thu, 12 Oct 2006 10:41:53 -0400
- To: www-dom@w3.org
- CC: Philippe Le Hegaret <plh@w3.org>, Liam Quin <liam@w3.org>
- Message-ID: <87ac41egum.fsf@nwalsh.com>
I think the description of textContent in the DOM Level 3 Core Specification is incorrect with respect to attributes. The description of textContent[1] begins: textContent of type DOMString, introduced in DOM Level 3 This attribute returns the text content of this node and its descendants... which makes sense, but subsequently: The string returned is made of the text content of this node depending on its type, as defined below: Node type Content ELEMENT_NODE, ATTRIBUTE_NODE, concatenation of the textContent attribute ENTITY_NODE, value of every child node, excluding ENTITY_REFERENCE_NODE, COMMENT_NODE and PROCESSING_INSTRUCTION_NODE DOCUMENT_FRAGMENT_NODE nodes. This is the empty string if the node has no children. TEXT_NODE, CDATA_SECTION_NODE, nodeValue COMMENT_NODE, PROCESSING_INSTRUCTION_NODE DOCUMENT_NODE, null DOCUMENT_TYPE_NODE, NOTATION_NODE Surely ATTRIBUTE_NODEs belong in the second row of that table. As currently specified, the textContent of an ATTRIBUTE_NODE is the concatentation of the textContent values of its children. As attributes have no children, it must always be null. Be seeing you, norm [1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent -- Norman Walsh <ndw@nwalsh.com> | It does not do harm to the mystery to http://nwalsh.com/ | know a little about it. For far more | marvelous is the truth than any artists | of the past imagined!--Richard Feynman
Received on Thursday, 12 October 2006 14:42:38 UTC