Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29038
| From | Joao Rodrigues <groups_jr-1@yahoo.com.br> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: "Node.textContent" |
| Date | 2015-12-25 12:10 -0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <n5jiob$svi$1@speranza.aioe.org> (permalink) |
| References | <Node.textContent-20151224191208@ram.dialup.fu-berlin.de> |
On 24/12/2015 16:21, Stefan Ram wrote:
> The web page at
>
> developer.mozilla.org/en-US/docs/Web/API/Node
>
> contains: »
>
> Node.textContent
Notice the capital letter "N", which means the Interface Node of the DOM
Levels 3 [1] and 4 [2].
>
> Is a DOMString representing the textual content
> of an element and all its descendants.
interface Node {
// NodeTypes ...
// ...
// attributes ...
// Introduced in DOM Level 3:
attribute DOMString textContent;
// ...
};
>
> «. Do I think correctly when I think that when this property
> represents the textual content /of an element/, I would
> expect it to be part of the interface »Element« and not »Node«?
No, textContent is a readable/writeable attribute of the interface Node.
The DOM presents documents as a hierarchy of Node objects that also
implement other, more specialized interfaces.
Node is an abstract interface and does not exist as node. It is used by
all nodes (Document, DocumentFragment, DocumentType, Element, Text,
ProcessingInstruction, and Comment). [2]
>
> The documentation does not even bother to specify the value
> or meaning of this property for a non-element node.
>
> BTW: In the above quotation, they use the Verb »Is«, not
> »Returns«.
>
MDN is very cool, but it is not a substitute for the W3C Standards and
Drafts [3]. Interestingly, three editors of the W3C DOM4 recommendation
are from Mozilla.
textContent may return null [4].
[1] <http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1950641247>
[2] <http://www.w3.org/TR/dom/#node>
[3] <http://www.w3.org/TR/#tr_DOM>
[4] <http://www.w3.org/TR/dom/#dom-node-textcontent>
--
Joao Rodrigues
Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread
Re: "Node.textContent" Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-25 12:10 -0200
csiph-web