Changeset 142831 in webkit


Ignore:
Timestamp:
Feb 13, 2013 5:31:14 PM (11 years ago)
Author:
Vineet
Message:

HTMLCollections namedItem() methods should return null than undefined for empty collections.
https://bugs.webkit.org/show_bug.cgi?id=104096

Reviewed by Kentaro Hara.

As per specification namedItem() should return null if collection is empty.
Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection

Source/WebCore:

Test: fast/dom/htmlcollection-namedItem.html

  • bindings/js/JSHTMLAllCollectionCustom.cpp: Returning null.

(WebCore::getNamedItems):

  • bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Ditto.

(WebCore::getNamedItems):

  • bindings/js/JSHTMLOptionsCollectionCustom.cpp: Ditto.

(WebCore::getNamedItems):

  • bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: Ditto.

(WebCore::V8HTMLAllCollection::namedItemCallback):

  • bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp: Ditto.

(WebCore::V8HTMLFormControlsCollection::namedItemCallback):

  • bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: Ditto.

(WebCore::V8HTMLOptionsCollection::namedItemCallback):

LayoutTests:

  • fast/dom/HTMLFormElement/move-option-between-documents-expected.txt:
  • fast/dom/HTMLFormElement/move-option-between-documents.html:
  • fast/dom/htmlcollection-namedItem-expected.txt: Added.
  • fast/dom/htmlcollection-namedItem.html: Added.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142829 r142831  
     12013-02-13   Vineet Chaudhary  <rgf748@motorola.com>
     2
     3        HTMLCollections namedItem() methods should return null than undefined for empty collections.
     4        https://bugs.webkit.org/show_bug.cgi?id=104096
     5
     6        Reviewed by Kentaro Hara.
     7
     8        As per specification namedItem() should return null if collection is empty.
     9        Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
     10
     11        * fast/dom/HTMLFormElement/move-option-between-documents-expected.txt:
     12        * fast/dom/HTMLFormElement/move-option-between-documents.html:
     13        * fast/dom/htmlcollection-namedItem-expected.txt: Added.
     14        * fast/dom/htmlcollection-namedItem.html: Added.
     15
    1162013-02-13  Tony Gentilcore  <tonyg@chromium.org>
    217
  • trunk/LayoutTests/fast/dom/HTMLFormElement/move-option-between-documents-expected.txt

    r80797 r142831  
    1 PASS typeof select.options.namedItem('option') is 'undefined'
     1PASS select.options.namedItem('option') is null
    22PASS successfullyParsed is true
    33
  • trunk/LayoutTests/fast/dom/HTMLFormElement/move-option-between-documents.html

    r98407 r142831  
    3636    doc1.body.removeChild(select);
    3737    doc2.body.appendChild(select);
    38     shouldBe("typeof select.options.namedItem('option')", "'undefined'");
     38    shouldBeNull("select.options.namedItem('option')");
    3939    finishJSTest();
    4040}
  • trunk/Source/WebCore/ChangeLog

    r142829 r142831  
     12013-02-13   Vineet Chaudhary  <rgf748@motorola.com>
     2
     3        HTMLCollections namedItem() methods should return null than undefined for empty collections.
     4        https://bugs.webkit.org/show_bug.cgi?id=104096
     5
     6        Reviewed by Kentaro Hara.
     7
     8        As per specification namedItem() should return null if collection is empty.
     9        Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
     10
     11        Test: fast/dom/htmlcollection-namedItem.html
     12
     13        * bindings/js/JSHTMLAllCollectionCustom.cpp: Returning null.
     14        (WebCore::getNamedItems):
     15        * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Ditto.
     16        (WebCore::getNamedItems):
     17        * bindings/js/JSHTMLOptionsCollectionCustom.cpp: Ditto.
     18        (WebCore::getNamedItems):
     19        * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: Ditto.
     20        (WebCore::V8HTMLAllCollection::namedItemCallback):
     21        * bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp: Ditto.
     22        (WebCore::V8HTMLFormControlsCollection::namedItemCallback):
     23        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: Ditto.
     24        (WebCore::V8HTMLOptionsCollection::namedItemCallback):
     25
    1262013-02-13  Tony Gentilcore  <tonyg@chromium.org>
    227
  • trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp

    r140718 r142831  
    4747
    4848    if (namedItems.isEmpty())
    49         return jsUndefined();
     49        return jsNull();
    5050    if (namedItems.size() == 1)
    5151        return toJS(exec, collection->globalObject(), namedItems[0].get());
  • trunk/Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp

    r136850 r142831  
    4545
    4646    if (namedItems.isEmpty())
    47         return jsUndefined();
     47        return jsNull();
    4848    if (namedItems.size() == 1)
    4949        return toJS(exec, collection->globalObject(), namedItems[0].get());
  • trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp

    r142810 r142831  
    4545
    4646    if (namedItems.isEmpty())
    47         return jsUndefined();
     47        return jsNull();
    4848    if (namedItems.size() == 1)
    4949        return toJS(exec, collection->globalObject(), namedItems[0].get());
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp

    r141763 r142831  
    9898
    9999    if (result.IsEmpty())
    100         return v8::Undefined();
     100        return v8Null(args.GetIsolate());
    101101
    102102    return result;
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp

    r141763 r142831  
    7272
    7373    if (result.IsEmpty())
    74         return v8::Undefined(args.GetIsolate());
     74        return v8Null(args.GetIsolate());
    7575
    7676    return result;
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp

    r142810 r142831  
    7878
    7979    if (result.IsEmpty())
    80         return v8::Undefined(args.GetIsolate());
     80        return v8Null(args.GetIsolate());
    8181
    8282    return result;
Note: See TracChangeset for help on using the changeset viewer.