Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #29038 > unrolled thread

Re: "Node.textContent"

Started byJoao Rodrigues <groups_jr-1@yahoo.com.br>
First post2015-12-25 12:10 -0200
Last post2015-12-25 12:10 -0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.javascript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: "Node.textContent" Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-25 12:10 -0200

#29038 — Re: "Node.textContent"

FromJoao Rodrigues <groups_jr-1@yahoo.com.br>
Date2015-12-25 12:10 -0200
SubjectRe: "Node.textContent"
Message-ID<n5jiob$svi$1@speranza.aioe.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web