Index: Source/core/dom/NamedNodeMap.cpp |
diff --git a/Source/core/dom/NamedNodeMap.cpp b/Source/core/dom/NamedNodeMap.cpp |
index ebb226ffdb2978434f7dbfb128b07d1f3b9bce5f..bac96429a3ddb58517354eabe77d876623754875 100644 |
--- a/Source/core/dom/NamedNodeMap.cpp |
+++ b/Source/core/dom/NamedNodeMap.cpp |
@@ -99,16 +99,19 @@ PassRefPtrWillBeRawPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionS |
PassRefPtrWillBeRawPtr<Node> NamedNodeMap::item(unsigned index) const |
{ |
- if (index >= length()) |
+ if (!m_element->hasAttributes()) |
+ return nullptr; |
+ AttributeCollection attributes = m_element->attributes(); |
+ if (index >= attributes.size()) |
return nullptr; |
- return m_element->ensureAttr(m_element->attributeAt(index).name()); |
+ return m_element->ensureAttr(attributes[index].name()); |
} |
size_t NamedNodeMap::length() const |
{ |
if (!m_element->hasAttributes()) |
return 0; |
- return m_element->attributeCount(); |
+ return m_element->attributes().size(); |
} |
void NamedNodeMap::trace(Visitor* visitor) |