ParentNode

Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.

The ParentNode interface contains methods that are particular to Node objects that can have children.

ParentNode is a raw interface and no object of this type can be created; it is implemented by Element, Document, and DocumentFragment objects.

 

Properties

ParentNode.children Lecture seule
Returns a live HTMLCollection containing all objects of type Element that are children of this ParentNode.
ParentNode.firstElementChild Lecture seule
Returns the Element that is the first child of this ParentNode, or null if there is none.
ParentNode.lastElementChild Lecture seule
Returns the Element that is the last child of this ParentNode, or null if there is none.
ParentNode.childElementCount Lecture seule
Returns an unsigned long giving the amount of children that the object has.

Methods

There is no inherited or specific and implemented methods.

Specification

Specification Status Comment
DOM
La définition de 'ParentNode.firstElementChild' dans cette spécification.
Living Standard Splitted the ElementTraversal interface in ChildNode and ParentNode. The firstElementChild, lastElementChild, and childElementCount properties are now defined on the latter.
The Document and DocumentFragment implemented the new interfaces.
Added the children property.
Added the append() and prepend() methods.
Element Traversal Specification
La définition de 'ElementTraversal' dans cette spécification.
'
Recommendation Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (on Element) 1.0 3.5 (1.9.1) 9.0 [1] 10.0 4.0
Support on Document and DocumentFragment 29.0 25.0 (25.0) Pas de support 16.0 Pas de support
append() and prepend() Pas de support Pas de support Pas de support Pas de support Pas de support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (on Element) (Oui) 1.0 (1.9.1) (Oui) (Oui) (Oui)
Support on Document and DocumentFragment (Oui) 25.0 (25.0) Pas de support 16.0 Pas de support
append() and prepend() Pas de support Pas de support Pas de support Pas de support Pas de support

[1] Internet Explorer 6, 7 and 8 supported it, but erroneously returns Comment nodes as part of the results.

See also

Étiquettes et contributeurs liés au document

Étiquettes : 
 Contributeurs à cette page : fscholz
 Dernière mise à jour par : fscholz,