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


Groups > comp.lang.javascript > #29038

Re: "Node.textContent"

Path csiph.com!news.fcku.it!aioe.org!.POSTED!not-for-mail
From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: "Node.textContent"
Date Fri, 25 Dec 2015 12:10:19 -0200
Organization Aioe.org NNTP Server
Lines 60
Message-ID <n5jiob$svi$1@speranza.aioe.org> (permalink)
References <Node.textContent-20151224191208@ram.dialup.fu-berlin.de>
NNTP-Posting-Host 5oq0M7qGeWhU/PcHEWLGrQ.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.javascript:29038

Show key headers only | View raw


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


Thread

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

csiph-web