Changeset 105870 in webkit
- Timestamp:
- Jan 25, 2012 5:04:24 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r105869 r105870 1 2012-01-25 Pablo Flouret <pablof@motorola.com> 2 3 Fix incorrect behavior in HTMLCollection.prototype.item(). 4 https://bugs.webkit.org/show_bug.cgi?id=74468 5 6 Reviewed by Adam Barth. 7 8 HTMLCollection.prototype.item("someString") was falling back to 9 .namedItem("someString"), which is wrong per spec. Also align the 10 handling of various other types of objects passed as the argument with 11 the spec and the rest of the browsers. 12 13 * fast/dom/collection-item-expected.txt: Added. 14 * fast/dom/collection-item.html: Added. 15 1 16 2012-01-25 Mike Lawther <mikelawther@chromium.org> 2 17 -
trunk/Source/WebCore/ChangeLog
r105868 r105870 1 2012-01-25 Pablo Flouret <pablof@motorola.com> 2 3 Fix incorrect behavior in HTMLCollection.prototype.item(). 4 https://bugs.webkit.org/show_bug.cgi?id=74468 5 6 Reviewed by Adam Barth. 7 8 HTMLCollection.prototype.item("someString") was falling back to 9 .namedItem("someString"), which is wrong per spec. Also align the 10 handling of various other types of objects passed as the argument with 11 the spec and the rest of the browsers. 12 13 Test: fast/dom/collection-item.html 14 15 * bindings/js/JSHTMLCollectionCustom.cpp: Remove custom implementation of item(). 16 * bindings/v8/custom/V8HTMLCollectionCustom.cpp: Ditto. 17 * html/HTMLCollection.idl: Remove [Custom] in item(), it's not needed. 18 1 19 2012-01-25 Sheriff Bot <webkit.review.bot@gmail.com> 2 20 -
trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
r105698 r105870 70 70 } 71 71 72 JSValue JSHTMLCollection::item(ExecState* exec)73 {74 bool ok;75 uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec)->value(exec), ok);76 if (ok)77 return toJS(exec, globalObject(), impl()->item(index));78 return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));79 }80 81 72 JSValue JSHTMLCollection::namedItem(ExecState* exec) 82 73 { -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
r99958 r105870 56 56 } 57 57 58 static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)59 {60 v8::Local<v8::Uint32> index = argument->ToArrayIndex();61 if (index.IsEmpty()) {62 v8::Local<v8::String> asString = argument->ToString();63 if (asString.IsEmpty())64 return v8::Handle<v8::Value>();65 v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(asString));66 67 if (result.IsEmpty())68 return v8::Undefined();69 70 return result;71 }72 73 RefPtr<Node> result = collection->item(index->Uint32Value());74 return toV8(result.release());75 }76 77 58 v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 78 59 { … … 86 67 HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder()); 87 68 return getNamedItems(imp, v8StringToAtomicWebCoreString(name)); 88 }89 90 v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args)91 {92 INC_STATS("DOM.HTMLCollection.item()");93 HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());94 return getItem(imp, args[0]);95 69 } 96 70 -
trunk/Source/WebCore/html/HTMLCollection.idl
r99958 r105870 29 29 ] HTMLCollection { 30 30 readonly attribute unsigned long length; 31 [Custom]Node item(in [Optional=CallWithDefaultValue] unsigned long index);31 Node item(in [Optional=CallWithDefaultValue] unsigned long index); 32 32 [Custom] Node namedItem(in [Optional=CallWithDefaultValue] DOMString name); 33 33
Note: See TracChangeset
for help on using the changeset viewer.