Changeset 154005 in webkit


Ignore:
Timestamp:
Aug 13, 2013 9:18:43 AM (11 years ago)
Author:
Christophe Dumez
Message:

HTMLSelectElement.item() does not behave according to specification
https://bugs.webkit.org/show_bug.cgi?id=119738

Reviewed by Darin Adler.

Source/WebCore:

Make HTMLSelectElement.item() behave according to specification:
http://www.w3.org/TR/html51/forms.html#dom-select-item
http://dom.spec.whatwg.org/#dom-htmlcollection-item

Namely, we no longer throw if the offset argument is negative. Also,
the argument is now mandatory.

IE10, Firefox and Blink do not throw when HTMLSelectElement.item() is
called with a negative value (as per the specification).

The argument is mandatory in Firefox and Blink, but optional in IE10
(it returns null when called without argument). This looks like a bug
in IE because other item() getters' argument is usually mandatory in IE
(e.g. NodeList.item()).

Test: fast/dom/HTMLSelectElement/select-element-item-argument.html

  • html/HTMLSelectElement.idl:

LayoutTests:

Add a new layout test to check that the HTMLSelectElement.item() indexed getter's
parameter is correctly validated.
Also update fast/dom/non-numeric-values-numeric-parameters.html now that the
argument is mandatory.

  • fast/dom/HTMLSelectElement/select-element-item-argument-expected.txt: Added.
  • fast/dom/HTMLSelectElement/select-element-item-argument.html: Added.
  • fast/dom/non-numeric-values-numeric-parameters-expected.txt:
  • fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154004 r154005  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        HTMLSelectElement.item() does not behave according to specification
     4        https://bugs.webkit.org/show_bug.cgi?id=119738
     5
     6        Reviewed by Darin Adler.
     7
     8        Add a new layout test to check that the HTMLSelectElement.item() indexed getter's
     9        parameter is correctly validated.
     10        Also update fast/dom/non-numeric-values-numeric-parameters.html now that the
     11        argument is mandatory.
     12
     13        * fast/dom/HTMLSelectElement/select-element-item-argument-expected.txt: Added.
     14        * fast/dom/HTMLSelectElement/select-element-item-argument.html: Added.
     15        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
     16        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
     17
    1182013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    219
  • trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt

    r146283 r154005  
    3232PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed'
    3333PASS nonNumericPolicy('createHTMLSelectElement().remove(x)') is 'any type allowed'
    34 PASS nonNumericPolicy('createHTMLSelectElement().item(x)') is 'any type allowed'
     34PASS nonNumericPolicy('createHTMLSelectElement().item(x)') is 'any type allowed (but not omitted)'
    3535PASS nonNumericPolicy('createHTMLTableElement().insertRow(x)') is 'any type allowed'
    3636PASS nonNumericPolicy('createHTMLTableElement().deleteRow(x)') is 'any type allowed'
  • trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js

    r145929 r154005  
    251251
    252252shouldBe("nonNumericPolicy('createHTMLSelectElement().remove(x)')", "'any type allowed'");
    253 shouldBe("nonNumericPolicy('createHTMLSelectElement().item(x)')", "'any type allowed'");
     253shouldBe("nonNumericPolicy('createHTMLSelectElement().item(x)')", "'any type allowed (but not omitted)'");
    254254
    255255// HTMLTableElement
  • trunk/Source/WebCore/ChangeLog

    r154004 r154005  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        HTMLSelectElement.item() does not behave according to specification
     4        https://bugs.webkit.org/show_bug.cgi?id=119738
     5
     6        Reviewed by Darin Adler.
     7
     8        Make HTMLSelectElement.item() behave according to specification:
     9        http://www.w3.org/TR/html51/forms.html#dom-select-item
     10        http://dom.spec.whatwg.org/#dom-htmlcollection-item
     11
     12        Namely, we no longer throw if the offset argument is negative. Also,
     13        the argument is now mandatory.
     14
     15        IE10, Firefox and Blink do not throw when HTMLSelectElement.item() is
     16        called with a negative value (as per the specification).
     17
     18        The argument is mandatory in Firefox and Blink, but optional in IE10
     19        (it returns null when called without argument). This looks like a bug
     20        in IE because other item() getters' argument is usually mandatory in IE
     21        (e.g. NodeList.item()).
     22
     23        Test: fast/dom/HTMLSelectElement/select-element-item-argument.html
     24
     25        * html/HTMLSelectElement.idl:
     26
    1272013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    228
  • trunk/Source/WebCore/html/HTMLSelectElement.idl

    r151714 r154005  
    4040    [SetterRaisesException] attribute unsigned long length;
    4141#endif
    42     getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
     42    getter Node item(unsigned long index);
    4343    Node namedItem([Default=Undefined] optional DOMString name);
    4444    [ObjCLegacyUnnamedParameters, RaisesException] void add([Default=Undefined] optional HTMLElement element,
Note: See TracChangeset for help on using the changeset viewer.