Onze vrijwilligers hebben dit artikel nog niet naar het Nederlands vertaald. Doe mee en help de klus te klaren!
The Document.documentElement
read-only property returns the Element
that is the root element of the document
(for example, the <html>
element for HTML documents).
Syntax
var element = document.documentElement;
Example
var rootElement = document.documentElement; var firstTier = rootElement.childNodes; // firstTier is the NodeList of the direct children of the root element for (var i = 0; i < firstTier.length; i++) { // do something with each direct kid of the root element // as firstTier[i] }
Notes
This property is a read-only convenience for getting the root element associated with any document.
HTML documents typically contain a single child node, <html>
, perhaps with a DOCTYPE declaration before it. XML documents often contain multiple child nodes: the root element, the DOCTYPE declaration, and processing instructions.
That's why you should use document.documentElement
rather than document.firstChild
to get the root element.
Specifications
Documentlabels en -medewerkers
Labels:
Aan deze pagina hebben bijgedragen:
teoli,
kosvrouvas,
Sheppy,
Scimonster,
joern.zaefferer,
kscarfone,
nehasharma,
ethertank,
fadak,
Mgjbot,
Shoot,
BenoitL,
Nickolay,
George3,
Ptak82,
Np,
Dria,
JesseW
Laatst bijgewerkt door:
teoli,