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
Somente leitura- Returns a live
HTMLCollection
containing all objects of typeElement
that are children of thisParentNode
. ParentNode.firstElementChild
Somente leitura- Returns the
Element
that is the first child of thisParentNode
, ornull
if there is none. ParentNode.lastElementChild
Somente leitura- Returns the
Element
that is the last child of thisParentNode
, ornull
if there is none. ParentNode.childElementCount
Somente leitura- Returns an
unsigned long
giving the amount of children that the object has.
Methods
ParentNode.append()
- Inserts a set of
Node
objects orDOMString
objects after the last child of theParentNode
.DOMString
objects are inserted as equivalentText
nodes. ParentNode.prepend()
- Inserts a set of
Node
objects orDOMString
objects before the first child of theParentNode
.DOMString
objects are inserted as equivalentText
nodes.
Specification
Specification | Status | Comment |
---|---|---|
DOM The definition of 'ParentNode.firstElementChild' in that specification. |
Padrão em tempo real | 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 The definition of 'ElementTraversal' in that specification. |
Obsoleto | Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element . |
Browser compatibility
Estamos convertendo nossos dados de compatibilidade para o formato JSON.
Esta tabela de compatibilidade ainda usa o formato antigo,
pois ainda não convertemos os dados que ela contém.
Descubra como você pode ajudar!
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 (25) | Não suportado | 16.0 | Não suportado |
append() and prepend() |
54.0 | 49 (49) | (Yes) | 39 | Não suportado |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Mobile |
---|---|---|---|---|---|---|---|
Basic support (on Element ) |
(Yes) | (Yes) | 1.0 (1.9.1) | (Yes) | (Yes) | (Yes) | (Yes) |
Support on Document and DocumentFragment |
(Yes) | (Yes) | 25.0 (25) | Não suportado | 16.0 | Não suportado | (Yes) |
append() and prepend() |
Não suportado | 54.0 | 49.0 (49) | Não suportado | 39 | Não suportado | 54.0 |
[1] Internet Explorer 6, 7 and 8 supported it, but erroneously returns Comment
nodes as part of the results.
See also
- The
ChildNode
pure interface.