diff options
Diffstat (limited to 'WebCore/bindings/js/JSHTMLCollectionCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index dd9af74..8ffddf7 100644 --- a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -23,12 +23,13 @@ #include "AtomicString.h" #include "HTMLCollection.h" #include "HTMLOptionsCollection.h" +#include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" #include "JSHTMLOptionsCollection.h" -#include "JSNamedNodesCollection.h" #include "JSNode.h" +#include "JSNodeList.h" #include "Node.h" -#include "JSDOMBinding.h" +#include "StaticNodeList.h" #include <wtf/Vector.h> using namespace JSC; @@ -42,11 +43,13 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, cons if (namedItems.isEmpty()) return jsUndefined(); - if (namedItems.size() == 1) return toJS(exec, collection->globalObject(), namedItems[0].get()); - return new (exec) JSNamedNodesCollection(exec, collection->globalObject(), namedItems); + // FIXME: HTML5 specifies that this should be a DynamicNodeList. + // FIXME: HTML5 specifies that non-HTMLOptionsCollection collections should return + // the first matching item instead of a NodeList. + return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get()); } // HTMLCollections are strange objects, they support both get and call, |