Baseline Widely available
ParentNode.childElementCount
ì½ê¸° ì ì© ìì±ì 주ì´ì§ ììì ìì ìì ê°ì를 unsigned long
íì
ì¼ë¡ ë°íí©ëë¤.
ì°¸ê³ : ì´ ìì±ì ì²ìì ElementTraversal
ì¸í°íì´ì¤ì ì ìëììµëë¤. ì´ ì¸í°íì´ì¤ë ììì´ ìë Node
ì ìì Node
를 ìí ë ê°ì§ ê³ ì í ìì± ì§í©ì í¬í¨íê³ ììëë°, ê°ê° ParentNode
ì ChildNode
ê°ë³ ì¸í°íì´ì¤ë¡ ì´ëëììµëë¤. childElementCount
ì ê²½ì° ParentNode
ë¡ ì´ëíìµëë¤. ì´ê²ì 기ì ì ì¸ ë³íë¡ í¸íì±ìë ìí¥ì 미ì¹ì§ ììµëë¤.
var count = node.childElementCount;
count
unsigned long
(ì ì) íì
ì ë°íê°.
node
Document
, DocumentFragment
ëë Element
ê°ì²´.
var foo = document.getElementById("foo");
if (foo.childElementCount > 0) {
// Do something
}
í´ë¦¬í (IE8 & IE9 & Safari)
ì´ ìì±ì IE9 ì´ì ë²ì ììë ì§ìíì§ ììµëë¤. IE9ê³¼ Safarië Document
ì DocumentFragment
ê°ì²´ìì ì´ ìì±ì ì§ìíì§ ììµëë¤.
(function (constructor) {
if (
constructor &&
constructor.prototype &&
constructor.prototype.childElementCount == null
) {
Object.defineProperty(constructor.prototype, "childElementCount", {
get: function () {
var i = 0,
count = 0,
node,
nodes = this.childNodes;
while ((node = nodes[i++])) {
if (node.nodeType === 1) count++;
}
return count;
},
});
}
})(window.Node || window.Element);
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ì°¸ì¡°
ParentNode
ì ChildNode
ì¸í°íì´ì¤.Document
, Element
, DocumentFragment
.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4