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


Groups > comp.lang.javascript > #29026

Re: Element output in JavaScript consoles

From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Element output in JavaScript consoles
Date 2015-12-19 10:55 -0200
Organization Aioe.org NNTP Server
Message-ID <n53k3t$mp0$1@speranza.aioe.org> (permalink)
References <consoles-20151214163101@ram.dialup.fu-berlin.de> <nodeType-20151214175705@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 12/14/2015 02:57 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> document.firstElementChild
>> <html>
>
>    Ok, my preceding question has become less important
>    to me, because I now believe that for the first examples
>    a member with a primitive type is better, so I now use
>
> document.nodeType
>

node.firstElementChild is well supported by modern browsers [1], but it 
only returns the first child that is an element (nodeType = 1), and null 
otherwise. [1]

[1] <http://www.quirksmode.org/dom/w3c_traversal.html>
[2] <http://www.w3.org/TR/ElementTraversal/#attribute-firstElementChild>



-- 
Joao Rodrigues

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Element output in JavaScript consoles Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-19 10:55 -0200
  Re: Element output in JavaScript consoles Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-19 13:11 -0200

csiph-web