summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLCollection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/HTMLCollection.cpp')
-rw-r--r--WebCore/html/HTMLCollection.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp
index 2b29589..5e42d30 100644
--- a/WebCore/html/HTMLCollection.cpp
+++ b/WebCore/html/HTMLCollection.cpp
@@ -274,7 +274,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A
HTMLElement* e = static_cast<HTMLElement*>(element);
if (!checkName)
- return e->getAttribute(idAttr) == name;
+ return e->getAttribute(e->idAttributeName()) == name;
// document.all returns only images, forms, applets, objects and embeds
// by name (though everything by id)
@@ -285,7 +285,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A
e->hasLocalName(selectTag)))
return false;
- return e->getAttribute(nameAttr) == name && e->getAttribute(idAttr) != name;
+ return e->getAttribute(nameAttr) == name && e->getAttribute(e->idAttributeName()) != name;
}
Node* HTMLCollection::namedItem(const AtomicString& name) const
@@ -327,7 +327,7 @@ void HTMLCollection::updateNameCache() const
if (!element->isHTMLElement())
continue;
HTMLElement* e = static_cast<HTMLElement*>(element);
- const AtomicString& idAttrVal = e->getAttribute(idAttr);
+ const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName());
const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
if (!idAttrVal.isEmpty()) {
// add to id cache
@@ -366,7 +366,8 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >&
resetCollectionInfo();
updateNameCache();
-
+ m_info->checkConsistency();
+
Vector<Element*>* idResults = m_info->idCache.get(name.impl());
Vector<Element*>* nameResults = m_info->nameCache.get(name.impl());
@@ -381,6 +382,7 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >&
Node* HTMLCollection::nextNamedItem(const AtomicString& name) const
{
resetCollectionInfo();
+ m_info->checkConsistency();
for (Element* e = itemAfter(m_info->current); e; e = itemAfter(e)) {
if (checkForNameMatch(e, m_idsDone, name)) {