Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demix ParentNode.childElementCount #3372

Merged
merged 5 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@
/en-US/docs/DOM/DocumentTouch.createTouchList /en-US/docs/Web/API/Document/createTouchList
/en-US/docs/DOM/DocumentType /en-US/docs/Web/API/DocumentType
/en-US/docs/DOM/DynamicsCompressorNode /en-US/docs/Web/API/DynamicsCompressorNode
/en-US/docs/DOM/Element.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/DOM/Element.childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/DOM/Element.children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/DOM/Element.contentEditable /en-US/docs/Web/API/HTMLElement/contentEditable
/en-US/docs/DOM/Element.firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
Expand Down Expand Up @@ -2966,7 +2966,7 @@
/en-US/docs/Document_Object_Model_(DOM)/DocumentTouch.createTouch /en-US/docs/Web/API/Document/createTouch
/en-US/docs/Document_Object_Model_(DOM)/DocumentTouch.createTouchList /en-US/docs/Web/API/Document/createTouchList
/en-US/docs/Document_Object_Model_(DOM)/DocumentType /en-US/docs/Web/API/DocumentType
/en-US/docs/Document_Object_Model_(DOM)/Element.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Document_Object_Model_(DOM)/Element.childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/Document_Object_Model_(DOM)/Element.children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Document_Object_Model_(DOM)/Element.contentEditable /en-US/docs/Web/API/HTMLElement/contentEditable
/en-US/docs/Document_Object_Model_(DOM)/Element.firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
Expand Down Expand Up @@ -7507,7 +7507,6 @@
/en-US/docs/Web/API/Document/baseURI /en-US/docs/Web/API/Node/baseURI
/en-US/docs/Web/API/Document/cancelFullscreen /en-US/docs/Web/API/Document/exitFullscreen
/en-US/docs/Web/API/Document/charset /en-US/docs/Web/API/document/characterSet
/en-US/docs/Web/API/Document/childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/Document/children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Web/API/Document/defaultView/popstate_event /en-US/docs/Web/API/Window/popstate_event
/en-US/docs/Web/API/Document/defaultView/resize_event /en-US/docs/Web/API/Window/resize_event
Expand Down Expand Up @@ -7548,7 +7547,6 @@
/en-US/docs/Web/API/DocumentFragment.DocumentFragment /en-US/docs/Web/API/DocumentFragment/DocumentFragment
/en-US/docs/Web/API/DocumentFragment.querySelector /en-US/docs/Web/API/DocumentFragment/querySelector
/en-US/docs/Web/API/DocumentFragment.querySelectorAll /en-US/docs/Web/API/DocumentFragment/querySelectorAll
/en-US/docs/Web/API/DocumentFragment/childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/DocumentFragment/children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Web/API/DocumentFragment/firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
/en-US/docs/Web/API/DocumentFragment/lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild
Expand Down Expand Up @@ -7578,7 +7576,7 @@
/en-US/docs/Web/API/DynamicsCompressorNode.release /en-US/docs/Web/API/DynamicsCompressorNode/release
/en-US/docs/Web/API/DynamicsCompressorNode.threshold /en-US/docs/Web/API/DynamicsCompressorNode/threshold
/en-US/docs/Web/API/Element.attributes /en-US/docs/Web/API/Element/attributes
/en-US/docs/Web/API/Element.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/Element.childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/Web/API/Element.children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Web/API/Element.clientLeft /en-US/docs/Web/API/Element/clientLeft
/en-US/docs/Web/API/Element.clientTop /en-US/docs/Web/API/Element/clientTop
Expand Down Expand Up @@ -7617,7 +7615,6 @@
/en-US/docs/Web/API/Element/animationiteration_event /en-US/docs/Web/API/HTMLElement/animationiteration_event
/en-US/docs/Web/API/Element/animationstart_event /en-US/docs/Web/API/HTMLElement/animationstart_event
/en-US/docs/Web/API/Element/cancel_event /en-US/docs/Web/API/HTMLDialogElement/cancel_event
/en-US/docs/Web/API/Element/childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/Element/children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Web/API/Element/firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
/en-US/docs/Web/API/Element/fullscreenchange /en-US/docs/Web/API/Element/fullscreenchange_event
Expand All @@ -7641,7 +7638,7 @@
/en-US/docs/Web/API/Element/pointerup_event /en-US/docs/Web/API/HTMLElement/pointerup_event
/en-US/docs/Web/API/Element/remove /en-US/docs/Web/API/ChildNode/remove
/en-US/docs/Web/API/Element/resourcetimingbufferfull_event /en-US/docs/Web/API/Performance/resourcetimingbufferfull_event
/en-US/docs/Web/API/ElementTraversal.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/ElementTraversal.childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/Web/API/ElementTraversal.firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
/en-US/docs/Web/API/ElementTraversal.lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild
/en-US/docs/Web/API/ElementTraversal.nextElementSibling /en-US/docs/Web/API/Element/nextElementSibling
Expand Down Expand Up @@ -8465,10 +8462,11 @@
/en-US/docs/Web/API/PannerNode.setOrientation /en-US/docs/Web/API/PannerNode/setOrientation
/en-US/docs/Web/API/PannerNode.setPosition /en-US/docs/Web/API/PannerNode/setPosition
/en-US/docs/Web/API/PannerNode.setVelocity /en-US/docs/Web/API/PannerNode/setVelocity
/en-US/docs/Web/API/ParentNode.childElementCount /en-US/docs/Web/API/ParentNode/childElementCount
/en-US/docs/Web/API/ParentNode.childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/Web/API/ParentNode.children /en-US/docs/Web/API/ParentNode/children
/en-US/docs/Web/API/ParentNode.firstElementChild /en-US/docs/Web/API/ParentNode/firstElementChild
/en-US/docs/Web/API/ParentNode.lastElementChild /en-US/docs/Web/API/ParentNode/lastElementChild
/en-US/docs/Web/API/ParentNode/childElementCount /en-US/docs/Web/API/Element/childElementCount
/en-US/docs/Web/API/PasswordCredential/additionalData /en-US/docs/Web/API/PasswordCredential
/en-US/docs/Web/API/PasswordCredential/idName /en-US/docs/Web/API/PasswordCredential
/en-US/docs/Web/API/PasswordCredential/passwordName /en-US/docs/Web/API/PasswordCredential
Expand Down
46 changes: 23 additions & 23 deletions files/en-us/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -71118,29 +71118,6 @@
"fscholz"
]
},
"Web/API/ParentNode/childElementCount": {
"modified": "2020-10-15T21:05:55.635Z",
"contributors": [
"sideshowbarker",
"mfluehr",
"adyouri",
"ExE-Boss",
"K-Gun",
"jszhou",
"uxfed",
"Alhadis",
"fscholz",
"jsx",
"411911.ca",
"Kartik_Chadha",
"teoli",
"ethertank",
"Sheppy",
"trevorh",
"ziyunfei",
"Jürgen Jeka"
]
},
"Web/API/ParentNode/children": {
"modified": "2020-10-15T21:05:52.672Z",
"contributors": [
Expand Down Expand Up @@ -165770,5 +165747,28 @@
"david_ross",
"jpmedley"
]
},
"Web/API/Element/childElementCount": {
"modified": "2020-10-15T21:05:55.635Z",
"contributors": [
"sideshowbarker",
"mfluehr",
"adyouri",
"ExE-Boss",
"K-Gun",
"jszhou",
"uxfed",
"Alhadis",
"fscholz",
"jsx",
"411911.ca",
"Kartik_Chadha",
"teoli",
"ethertank",
"Sheppy",
"trevorh",
"ziyunfei",
"Jürgen Jeka"
]
}
}
54 changes: 54 additions & 0 deletions files/en-us/web/api/document/childelementcount/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Document.childElementCount
slug: Web/API/Document/childElementCount
tags:
- API
- DOM
- Property
- Reference
---
<div>{{ APIRef("DOM") }}</div>

<p>The <code><strong>Document.childElementCount</strong></code> read-only property
returns the number of child elements of the document.</p>

<p>To get the number of children of a specific element, see {{domxref("Element.childElementCount")}}.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: js"><em>document</em>.childElementCount;
</pre>

<h2 id="Example">Example</h2>

<pre class="brush:js">
document.children;
// HTMLCollection, usually containing an &lt;html&gt; element, the document's only child

document.childElementCount;
// 1
</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-childelementcount', 'ParentNode.childElementCount')}}</td>
</tr>
</tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{Compat("api.Document.childElementCount")}}</p>

<h2 id="See_also">See also</h2>

<ul>
<li>{{domxref("Element.childElementCount")}}</li>
<li>{{domxref("DocumentFragment.childElementCount")}}</li>
</ul>
6 changes: 2 additions & 4 deletions files/en-us/web/api/document/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ <h2 id="Properties">Properties</h2>
<dd>Returns the {{HTMLElement("body")}} or {{htmlelement("frameset")}} node of the current document.</dd>
<dt>{{DOMxRef("Document.characterSet")}}{{ReadOnlyInline}}</dt>
<dd>Returns the character set being used by the document.</dd>
<dt>{{domxref("Document.childElementCount")}} {{readonlyInline}}</dt>
<dd>Returns the number of child elements of the current document.</dd>
<dt>{{DOMxRef("Document.compatMode")}} {{Experimental_Inline}}{{ReadOnlyInline}}</dt>
<dd>Indicates whether the document is rendered in <em>quirks</em> or <em>strict</em> mode.</dd>
<dt>{{DOMxRef("Document.contentType")}} {{Experimental_Inline}}{{ReadOnlyInline}}</dt>
Expand Down Expand Up @@ -88,10 +90,6 @@ <h2 id="Properties">Properties</h2>
<dd>Returns a <code>string</code> denoting the visibility state of the document. Possible values are <code>visible</code>, <code>hidden</code>, <code>prerender</code>, and <code>unloaded</code>.</dd>
</dl>

<p>The <code>Document</code> interface is extended with the {{DOMxRef("ParentNode")}} interface:</p>

<p>{{page("/en-US/docs/Web/API/ParentNode","Properties")}}</p>

<h3 id="Extensions_for_HTMLDocument">Extensions for HTMLDocument</h3>

<p><em>The <code>Document</code> interface for HTML documents inherits from the {{DOMxRef("HTMLDocument")}} interface or, since HTML5, is extended for such documents.</em></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: DocumentFragment.childElementCount
slug: Web/API/DocumentFragment/childElementCount
tags:
- API
- DOM
- Property
- Reference
---
<div>{{ APIRef("DOM") }}</div>

<p>The <code><strong>Document.childElementCount</strong></code> read-only property
returns the number of child elements of a <code>DocumentFragment</code>.</p>

<p>To get the number of children of a specific element, see {{domxref("Element.childElementCount")}}.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: js"><em>fragment</em>.childElementCount;
</pre>

<h2 id="Example">Example</h2>

<pre class="brush:js">
let fragment = new DocumentFragment()
fragment.childElementCount; // 0

let paragraph = document.createElement('p')
fragment.appendChild(paragraph)

fragment.childElementCount; // 1
</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-childelementcount', 'ParentNode.childElementCount')}}</td>
</tr>
</tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{Compat("api.DocumentFragment.childElementCount")}}</p>

<h2 id="See_also">See also</h2>

<ul>
<li>{{domxref("Element.childElementCount")}}</li>
<li>{{domxref("Document.childElementCount")}}</li>
</ul>
4 changes: 2 additions & 2 deletions files/en-us/web/api/documentfragment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ <h2 id="Properties">Properties</h2>
<p><em>This interface has no specific properties, but inherits those of its parent, {{domxref("Node")}}, and implements those of the {{domxref("ParentNode")}} interface.</em></p>

<dl>
<dt>{{ domxref("DocumentFragment.childElementCount") }} {{readonlyInline}} </dt>
<dd>Returns the amount of child {{domxref("Element","elements")}} the <code>DocumentFragment</code> has.</dd>
<dt>{{ domxref("ParentNode.children") }} {{readonlyInline}}{{experimental_inline}}</dt>
<dd>Returns a live {{domxref("HTMLCollection")}} containing all objects of type {{domxref("Element")}} that are children of the <code>DocumentFragment</code> object.</dd>
<dt>{{ domxref("ParentNode.firstElementChild") }} {{readonlyInline}}{{experimental_inline}}</dt>
<dd>Returns the {{domxref("Element")}} that is the first child of the <code>DocumentFragment</code> object, or <code>null</code> if there is none.</dd>
<dt>{{ domxref("ParentNode.lastElementChild") }} {{readonlyInline}}{{experimental_inline}}</dt>
<dd>Returns the {{domxref("Element")}} that is the last child of the <code>DocumentFragment</code> object, or <code>null</code> if there is none.</dd>
<dt>{{ domxref("ParentNode.childElementCount") }} {{readonlyInline}}{{experimental_inline}}</dt>
<dd>Returns an <code>unsigned long</code> giving the amount of child {{domxref("Element","elements")}} the <code>DocumentFragment</code> has.</dd>
</dl>

<h2 id="Methods">Methods</h2>
Expand Down
49 changes: 49 additions & 0 deletions files/en-us/web/api/element/childelementcount/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Element.childElementCount
slug: Web/API/Element/childElementCount
tags:
- API
- DOM
- Property
- Reference
---
<div>{{ APIRef("DOM") }}</div>

<p>The <code><strong>Element.childElementCount</strong></code> read-only property
returns the number of child elements of this element.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: js">element.childElementCount;</pre>

<h2 id="Example">Example</h2>

<pre class="brush:js">let sidebar = document.getElementById('sidebar');
if (sidebar.childElementCount &gt; 0) {
// Do something
}
</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-childelementcount', 'ParentNode.childElementCount')}}</td>
</tr>
</tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{Compat("api.Element.childElementCount")}}</p>

<h2 id="See_also">See also</h2>

<ul>
<li>{{domxref("Document.childElementCount")}}</li>
<li>{{domxref("DocumentFragment.childElementCount")}}</li>
</ul>
2 changes: 2 additions & 0 deletions files/en-us/web/api/element/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ <h2 id="Properties">Properties</h2>
<dd>Returns a {{DOMxRef("HTMLSlotElement")}} representing the {{htmlelement("slot")}} the node is inserted in.</dd>
<dt>{{DOMxRef("Element.attributes")}} {{readOnlyInline}}</dt>
<dd>Returns a {{DOMxRef("NamedNodeMap")}} object containing the assigned attributes of the corresponding HTML element.</dd>
<dt>{{domxref("Element.childElementCount")}} {{readonlyInline}}</dt>
<dd>Returns the number of child elements of this element.</dd>
<dt>{{DOMxRef("Element.classList")}} {{readOnlyInline}}</dt>
<dd>Returns a {{DOMxRef("DOMTokenList")}} containing the list of class attributes.</dd>
<dt>{{DOMxRef("Element.className")}}</dt>
Expand Down
Loading