Document: firstElementChild-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die schreibgeschützte Eigenschaft Document.firstElementChild
gibt das erste Kind-Element
des Dokuments zurück oder null
, falls keine Kindelemente vorhanden sind.
Für HTML-Dokumente ist dies normalerweise das einzige Kind, das <html>
-Wurzelelement.
Siehe Element.firstElementChild
für das erste Kindelement von spezifischen Elementen innerhalb eines Dokuments.
Wert
Ein Element
-Objekt oder null
.
Beispiele
document.firstElementChild;
// returns the root <html> element, the only child of the document
Spezifikationen
Specification |
---|
DOM # ref-for-dom-parentnode-firstelementchild① |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
firstElementChild |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support