diff options
Diffstat (limited to 'WebCore/html/HTMLFormCollection.cpp')
-rw-r--r-- | WebCore/html/HTMLFormCollection.cpp | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/WebCore/html/HTMLFormCollection.cpp b/WebCore/html/HTMLFormCollection.cpp index 823291a..03796d6 100644 --- a/WebCore/html/HTMLFormCollection.cpp +++ b/WebCore/html/HTMLFormCollection.cpp @@ -96,43 +96,31 @@ Node* HTMLFormCollection::item(unsigned index) const return 0; } -Element* HTMLFormCollection::getNamedItem(const QualifiedName& attrName, const String& name, bool caseSensitive) const +Element* HTMLFormCollection::getNamedItem(const QualifiedName& attrName, const AtomicString& name) const { info()->position = 0; - return getNamedFormItem(attrName, name, 0, caseSensitive); + return getNamedFormItem(attrName, name, 0); } -Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, const String& name, int duplicateNumber, bool caseSensitive) const +Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, const String& name, int duplicateNumber) const { HTMLFormElement* form = static_cast<HTMLFormElement*>(base()); bool foundInputElements = false; for (unsigned i = 0; i < form->formElements.size(); ++i) { HTMLFormControlElement* e = form->formElements[i]; - if (e->isEnumeratable()) { - bool found; - if (caseSensitive) - found = e->getAttribute(attrName) == name; - else - found = equalIgnoringCase(e->getAttribute(attrName), name); - if (found) { - foundInputElements = true; - if (!duplicateNumber) - return e; - --duplicateNumber; - } + if (e->isEnumeratable() && e->getAttribute(attrName) == name) { + foundInputElements = true; + if (!duplicateNumber) + return e; + --duplicateNumber; } } if (!foundInputElements) { for (unsigned i = 0; i < form->imgElements.size(); ++i) { HTMLImageElement* e = form->imgElements[i]; - bool found; - if (caseSensitive) - found = e->getAttribute(attrName) == name; - else - found = equalIgnoringCase(e->getAttribute(attrName), name); - if (found) { + if (e->getAttribute(attrName) == name) { if (!duplicateNumber) return e; --duplicateNumber; @@ -150,17 +138,17 @@ Node* HTMLFormCollection::nextItem() const Element* HTMLFormCollection::nextNamedItemInternal(const String &name) const { - Element* retval = getNamedFormItem(m_idsDone ? nameAttr : idAttr, name, ++info()->position, true); + Element* retval = getNamedFormItem(m_idsDone ? nameAttr : idAttr, name, ++info()->position); if (retval) return retval; if (m_idsDone) // we're done return 0; // After doing id, do name m_idsDone = true; - return getNamedItem(nameAttr, name, true); + return getNamedItem(nameAttr, name); } -Node* HTMLFormCollection::namedItem(const String& name, bool caseSensitive) const +Node* HTMLFormCollection::namedItem(const AtomicString& name) const { // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp // This method first searches for an object with a matching id @@ -169,15 +157,15 @@ Node* HTMLFormCollection::namedItem(const String& name, bool caseSensitive) cons // that are allowed a name attribute. resetCollectionInfo(); m_idsDone = false; - info()->current = getNamedItem(idAttr, name, true); + info()->current = getNamedItem(idAttr, name); if (info()->current) return info()->current; m_idsDone = true; - info()->current = getNamedItem(nameAttr, name, true); + info()->current = getNamedItem(nameAttr, name); return info()->current; } -Node* HTMLFormCollection::nextNamedItem(const String& name) const +Node* HTMLFormCollection::nextNamedItem(const AtomicString& name) const { // The nextNamedItemInternal function can return the same item twice if it has // both an id and name that are equal to the name parameter. So this function |