Index: Source/core/dom/ContainerNode.h |
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h |
index 967568d5d155b1baa67e7bac1480516fed12bd7b..62a3e3230b2b586de5a51f6d301914886bcef541 100644 |
--- a/Source/core/dom/ContainerNode.h |
+++ b/Source/core/dom/ContainerNode.h |
@@ -86,6 +86,7 @@ public: |
bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling(); } |
bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextNode(); } |
+ bool hasChildCount(unsigned) const; |
PassRefPtr<HTMLCollection> children(); |
@@ -176,6 +177,16 @@ bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); |
DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); |
+inline bool ContainerNode::hasChildCount(unsigned count) const |
+{ |
+ Node* child = m_firstChild; |
+ while (count && child) { |
+ child = child->nextSibling(); |
+ --count; |
+ } |
+ return !count && !child; |
+} |
+ |
inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) |
: Node(treeScope, type) |
, m_firstChild(0) |