-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demix Parentnode.{first,last}ElementChild to Element, Document, Docum…
…entFragment pages (#4070)
- Loading branch information
Showing
14 changed files
with
419 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Document.firstElementChild | ||
slug: Web/API/Document/firstElementChild | ||
tags: | ||
- API | ||
- DOM | ||
- Element | ||
- Property | ||
--- | ||
<p>{{ APIRef("DOM") }}</p> | ||
|
||
<p>The <strong><code>Document.firstElementChild</code></strong> read-only property | ||
returns the document's first child {{domxref("Element")}}, or <code>null</code> if there | ||
are no child elements.</p> | ||
|
||
<p>For HTML documents, this is usually the only child, the root <code><html></code> element.</p> | ||
|
||
<p>See {{domxref("Element.firstElementChild")}} for the first child element of specific elements within a document.</p> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="brush: js"> | ||
// Getter | ||
element = document.firstElementChild; | ||
|
||
// No setter; read-only property | ||
</pre> | ||
<h2 id="Example">Example</h2> | ||
|
||
<pre class="brush: js"> | ||
document.firstElementChild; | ||
// returns the root <html> element, the only child of the document | ||
</pre> | ||
|
||
<h2 id="Specifications">Specifications</h2> | ||
|
||
<table class="standard-table"> | ||
<tbody> | ||
<tr> | ||
<th scope="col">Specification</th> | ||
</tr> | ||
<tr> | ||
<td>{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<p>{{Compat("api.Document.firstElementChild")}}</p> | ||
|
||
<h2 id="See_also">See also</h2> | ||
|
||
<ul> | ||
<li>{{domxref("Element.firstElementChild")}}</li>´ | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Document.lastElementChild | ||
slug: Web/API/Document/lastElementChild | ||
tags: | ||
- API | ||
- DOM | ||
- Element | ||
- Property | ||
--- | ||
<p>{{ APIRef("DOM") }}</p> | ||
|
||
<p>The <strong><code>Document.lastElementChild</code></strong> read-only property | ||
returns the document's last child {{domxref("Element")}}, or <code>null</code> if there | ||
are no child elements.</p> | ||
|
||
<p>For HTML documents, this is usually the only child, the root <code><html></code> element.</p> | ||
|
||
<p>See {{domxref("Element.lastElementChild")}} for the last child element of specific elements within a document.</p> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="brush: js"> | ||
// Getter | ||
element = document.lastElementChild; | ||
|
||
// No setter; read-only property | ||
</pre> | ||
<h2 id="Example">Example</h2> | ||
|
||
<pre class="brush: js"> | ||
document.lastElementChild; | ||
// returns the root <html> element, the only child of the document | ||
</pre> | ||
|
||
<h2 id="Specifications">Specifications</h2> | ||
|
||
<table class="standard-table"> | ||
<tbody> | ||
<tr> | ||
<th scope="col">Specification</th> | ||
</tr> | ||
<tr> | ||
<td>{{SpecName('DOM WHATWG', '#dom-parentnode-lastelementchild', 'ParentNode.lastElementChild')}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<p>{{Compat("api.Document.lastElementChild")}}</p> | ||
|
||
<h2 id="See_also">See also</h2> | ||
|
||
<ul> | ||
<li>{{domxref("Element.lastElementChild")}}</li>´ | ||
</ul> |
57 changes: 57 additions & 0 deletions
57
files/en-us/web/api/documentfragment/firstelementchild/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: DocumentFragment.firstElementChild | ||
slug: Web/API/DocumentFragment/firstElementChild | ||
tags: | ||
- API | ||
- DOM | ||
- Element | ||
- Property | ||
--- | ||
<p>{{ APIRef("DOM") }}</p> | ||
|
||
<p>The <strong><code>DocumentFragment.firstElementChild</code></strong> read-only property | ||
returns the document fragment's first child {{domxref("Element")}}, or <code>null</code> if there | ||
are no child elements.</p> | ||
|
||
<h2 id="Syntax">Syntax</h2> | ||
|
||
<pre class="brush: js"> | ||
// Getter | ||
element = fragment.firstElementChild; | ||
|
||
// No setter; read-only property | ||
</pre> | ||
<h2 id="Example">Example</h2> | ||
|
||
<pre class="brush: js"> | ||
let fragment = new DocumentFragment(); | ||
fragment.firstElementChild; // null | ||
|
||
let paragraph = document.createElement('p'); | ||
fragment.appendChild(paragraph); | ||
|
||
fragment.firstElementChild; // <p> | ||
</pre> | ||
|
||
<h2 id="Specifications">Specifications</h2> | ||
|
||
<table class="standard-table"> | ||
<tbody> | ||
<tr> | ||
<th scope="col">Specification</th> | ||
</tr> | ||
<tr> | ||
<td>{{SpecName('DOM WHATWG', '#dom-parentnode-firstelementchild', 'ParentNode.firstElementChild')}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<h2 id="Browser_compatibility">Browser compatibility</h2> | ||
|
||
<p>{{Compat("api.DocumentFragment.firstElementChild")}}</p> | ||
|
||
<h2 id="See_also">See also</h2> | ||
|
||
<ul> | ||
<li>{{domxref("Element.firstElementChild")}}</li>´ | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.