Changeset 195642 in webkit


Ignore:
Timestamp:
Jan 26, 2016 5:16:16 PM (8 years ago)
Author:
Chris Dumez
Message:

Setting HTMLInputElement.value to null to set its value to the empty string
https://bugs.webkit.org/show_bug.cgi?id=153519

Reviewed by Ryosuke Niwa.

Source/WebCore:

Setting HTMLInputElement.value to null to set its value to the empty string:

WebKit would previously unset the value attribute instead, which caused
it to fallback to input.defaultValue if set.

Firefox and Chrome behave correctly.

Test: fast/dom/HTMLInputElement/input-value-set-null.html

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::setValue):

LayoutTests:

Add a layout test to make sure that setting HTMLInputElement.value to null
actually sets its value to the empty string.

  • fast/dom/HTMLInputElement/input-value-set-null-expected.txt: Added.
  • fast/dom/HTMLInputElement/input-value-set-null.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195638 r195642  
     12016-01-26  Chris Dumez  <cdumez@apple.com>
     2
     3        Setting HTMLInputElement.value to null to set its value to the empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=153519
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add a layout test to make sure that setting HTMLInputElement.value to null
     9        actually sets its value to the empty string.
     10
     11        * fast/dom/HTMLInputElement/input-value-set-null-expected.txt: Added.
     12        * fast/dom/HTMLInputElement/input-value-set-null.html: Added.
     13
    1142016-01-26  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r195635 r195642  
     12016-01-26  Chris Dumez  <cdumez@apple.com>
     2
     3        Setting HTMLInputElement.value to null to set its value to the empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=153519
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Setting HTMLInputElement.value to null to set its value to the empty string:
     9        - https://html.spec.whatwg.org/#htmlinputelement
     10        - http://heycam.github.io/webidl/#TreatNullAs
     11
     12        WebKit would previously unset the value attribute instead, which caused
     13        it to fallback to input.defaultValue if set.
     14
     15        Firefox and Chrome behave correctly.
     16
     17        Test: fast/dom/HTMLInputElement/input-value-set-null.html
     18
     19        * html/HTMLInputElement.cpp:
     20        (WebCore::HTMLInputElement::setValue):
     21
    1222016-01-26  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r195452 r195642  
    984984        return;
    985985    }
    986     setValue(value, eventBehavior);
     986    setValue(value.isNull() ? emptyString() : value, eventBehavior);
    987987}
    988988
Note: See TracChangeset for help on using the changeset viewer.