<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16472</bug_id>
          
          <creation_ts>2012-03-21 20:45:38 +0000</creation_ts>
          <short_desc>Consider DOMString? for HTMLInputElement:value IDL attribute</short_desc>
          <delta_ts>2012-10-14 12:29:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Travis Leithead [MSFT]">travil</reporter>
          <assigned_to name="Silvia Pfeiffer">silviapfeiffer1</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>robin</cc>
    
    <cc>silviapfeiffer1</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>65912</commentid>
    <comment_count>0</comment_count>
      <attachid>1105</attachid>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-03-21 20:45:38 +0000</bug_when>
    <thetext>Created attachment 1105
Test case for null assignment on common DOMString reflecting values

I just ran into a compatibility issue in IE10 (on site 58.com), where the site ends up assigning the null literal value to the input element&apos;s value IDL attribute.

As far as I can tell, IE10 is currently doing the &quot;correct&quot; behavior according to the current definition of the value IDL attribute and WebIDL conversion logic:

&lt;blockquote&gt;
The value IDL attribute allows scripts to manipulate the value of an input element. The attribute is in one of the following modes, which define its behavior:

* value
On getting, it must return the current value of the element. On setting, it must set the element&apos;s value to the new value, set the element&apos;s dirty value flag to true, invoke the value sanitization algorithm, if the element&apos;s type attribute&apos;s current state defines one, and then, if the element has a text entry cursor position, should move the text entry cursor position to the end of the text field, unselecting any selected text and resetting the selection direction to none.
&lt;/blockquote&gt;
(From HTML5 4.10.7.4)

On the site, the input is type=text, which means the value attribute is in the &quot;value&quot; mode. The value sanitization algorithm for that state just trims line breaks from the value.

Since, the HTMLInputElement interface WebIDL is defined as following:

interface HTMLInputElement : HTMLElement {
   [snip]
            attribute DOMString value;
   [snip]
};

Then the conversion of a null literal value should result in the string &quot;null&quot; being assigned per 4.2.16. of WebIDL.

IE10 places the string &quot;null&quot; in the value of the input type=text field. Unfortunately, the site does not want that to happen, instead, they expect the value to be the empty string so that the placeholder text is put in the input box instead.

At a minimum, I&apos;d recommending changing the value IDL attribute to either:

  [TreatNullAs=EmptyString] attribute DOMString value;
or
     attribute DOMString? value;
(and providing a description of how this IDL attribute handles null (e.g., by setting the value to the empty string)

... to ensure good interop and avoid site issues like the above-specified one.

I did some testing of other reflecting DOM attributes (on DIV and on HTMLInputElement -- see attached) under this same scenario, and IE is pretty consistent about assigning the string &quot;null&quot; in all these cases (going as far back as IE8--likely back to IE6, but I didn&apos;t test that).

While IE appears to have the correct behavior in these scenarios per the spec(and this behavior has not changed in some time), I wonder if this is the best behavior. According to the attached test, the other browsers aren&apos;t perfectly aligned on an alternate behavior, but none of them match IE at the moment. Interestingly, WebKit based browsers tend to clear the content attribute when null is assigned, whereas Firefox/Opera assign the empty string to the content attribute. This _does_ make a difference with respect to some attributes like &quot;title&quot; where the presence of the attribute (vs. an empty string value) make a difference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65983</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-03-23 14:08:54 +0000</bug_when>
    <thetext>I&apos;d much prefer the TreatNullAs approach to the prose approach, for what it&apos;s worth, as an implementor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65984</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2012-03-23 14:15:05 +0000</bug_when>
    <thetext>Since .value doesn&apos;t reflect the content attribute, I think it makes little sense to remove the content attribute when setting to null. Setting concept-value to the empty string seems OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68500</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2012-06-01 11:43:04 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Since .value doesn&apos;t reflect the content attribute, I think it makes little
&gt; sense to remove the content attribute when setting to null. Setting
&gt; concept-value to the empty string seems OK.

However, removing the content attribute when setting .defaultValue and other reflecting IDL attributes seems reasonable; https://www.w3.org/Bugs/Public/show_bug.cgi?id=17283</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70139</commentid>
    <comment_count>4</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 06:58:45 +0000</bug_when>
    <thetext>This bug was cloned to create bug 17834 as part of operation convergence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76239</commentid>
    <comment_count>5</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2012-10-14 12:29:50 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If
you are satisfied with this response, please change the state of
this bug to CLOSED. If you have additional information and would
like the Editor to reconsider, please reopen this bug. If you would
like to escalate the issue to the full HTML Working Group, please
add the TrackerRequest keyword to this bug, and suggest title and
text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this
document:   http://dev.w3.org/html5/decision-policy/decision-policy-v2.html

Status: Accepted
Change Description:
https://github.com/w3c/html/commit/827f02df82e56c91ec99f345f5dcbb5fcd088347
Rationale: accepted WHATWG change</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1105</attachid>
            <date>2012-03-21 20:45:38 +0000</date>
            <delta_ts>2012-03-21 20:45:38 +0000</delta_ts>
            <desc>Test case for null assignment on common DOMString reflecting values</desc>
            <filename>assign_null_to_IDL_attributes.htm</filename>
            <type>text/html</type>
            <size>4800</size>
            <attacher name="Travis Leithead [MSFT]">travil</attacher>
            
              <data encoding="base64">77u/PCFET0NUWVBFIGh0bWw+DQoNCjxodG1sIGxhbmc9ImVuIiB4bWxucz0iaHR0cDovL3d3dy53
My5vcmcvMTk5OS94aHRtbCI+DQo8aGVhZD4NCiAgICA8bWV0YSBjaGFyc2V0PSJ1dGYtOCIgLz4N
CiAgICA8dGl0bGU+PC90aXRsZT4NCiAgICA8c3R5bGU+DQogICAgICAgIGJvZHkgew0KICAgICAg
ICAgICAgZm9udC1mYW1pbHk6ICdTZWdvZSBVSSc7DQogICAgICAgIH0NCiAgICAgICAgdGggew0K
ICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzAwOTJmZjsNCiAgICAgICAgICAgIGNvbG9y
OiB3aGl0ZTsNCiAgICAgICAgICAgIGZvbnQtc2l6ZTogbGFyZ2VyOw0KICAgICAgICB9DQogICAg
ICAgIHRkLCB0aCB7DQogICAgICAgICAgICBwYWRkaW5nOiA1cHg7DQogICAgICAgIH0NCiAgICAg
ICAgdHI6bnRoLWNoaWxkKG9kZCkgew0KICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2Jk
ZTNmZjsNCiAgICAgICAgfQ0KICAgICAgICB0ZDpudGgtY2hpbGQoMiksIHRoOm50aC1jaGlsZCgy
KSB7DQogICAgICAgICA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
bWVudCkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFNldHVwRmFpbHVyZXMoIlNr
aXBwaW5nIG51bGwgYXNzaWdubWVudCB0byBwcm9wZXJ0eSAnIiArIElETEF0dHJzW2ldICsgIicg
YmVjYXVzZSBpdCBpcyBub3Qgc3VwcG9ydGVkIG9uIHRoZSAiICsgZWxlbWVudCk7DQogICAgICAg
ICAgICAgICAgICAgICAgICBza2lwT2JbaV0gPSB0cnVlOw0KICAgICAgICAgICAgICAgICAgICB9
DQogICAgICAgICAgICAgICAgICAgIGVsc2UNCiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1l
bnRbSURMQXR0cnNbaV1dID0gbnVsbDsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAg
ICAgY2F0Y2ggKGV4KSB7DQogICAgICAgICAgICAgICAgICAgIG91dHB1dFNldHVwRmFpbHVyZXMo
IkV4Y2VwdGlvbiByYWlzZWQgb24gbnVsbCBhc2lnbm1lbnQgdG8gcHJvcGVydHkgJyIgKyBJRExB
dHRyc1tpXSArICInIG9uIHRoZSAiICsgZWxlbWVudCk7DQogICAgICAgICAgICAgICAgICAgIHNr
aXBPYltpXSA9IHRydWU7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAg
ICB9DQoNCiAgICAgICAgZnVuY3Rpb24gb3V0cHV0U2V0dXBGYWlsdXJlcyhtc2cpIHsNCiAgICAg
ICAgICAgIHZhciB0ZXN0RmFpbCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2xpJyk7DQogICAg
ICAgICAgICB0ZXN0RmFpbC5pbm5lckhUTUwgPSBtc2c7DQogICAgICAgICAgICBkb2N1bWVudC5n
ZXRFbGVtZW50QnlJZCgicHJlVGVzdEZhaWx1cmVzIikuYXBwZW5kQ2hpbGQodGVzdEZhaWwpOw0K
ICAgICAgICB9DQoNCiAgICAgICAgZnVuY3Rpb24gb3V0cHV0VmFsdWVzKElETEF0dHJzLCBjb250
ZW50QXR0cnMsIGVsZW1lbnQsIHNraXBzKSB7DQogICAgICAgICAgICBmb3IgKHZhciBpID0gMDsg
aSA8IElETEF0dHJzLmxlbmd0aDsgaSsrKSB7DQogICAgICAgICAgICAgICAgaWYgKHNraXBzW2ld
KQ0KICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsNCiAgICAgICAgICAgICAgICB2YXIgY2xv
bmVUZW1wbGF0ZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjbG9uZSIpOw0KICAgICAgICAg
ICAgICAgIHZhciBjbG9uZSA9IGNsb25lVGVtcGxhdGUuY2xvbmVOb2RlKHRydWUpOw0KICAgICAg
ICAgICAgICAgIGNsb25lLnJlbW92ZUF0dHJpYnV0ZSgic3R5bGUiKTsNCiAgICAgICAgICAgICAg
ICBjbG9uZS5yZW1vdmVBdHRyaWJ1dGUoImlkIik7DQogICAgICAgICAgICAgICAgY2xvbmUuY2hp
bGRyZW5bMF0uaW5uZXJIVE1MID0gZWxlbWVudDsNCiAgICAgICAgICAgICAgICBjbG9uZS5jaGls
ZHJlblsxXS5pbm5lckhUTUwgPSBJRExBdHRyc1tpXTsNCiAgICAgICAgICAgICAgICBjbG9uZS5j
aGlsZHJlblsyXS5pbm5lckhUTUwgPSAoKGVsZW1lbnRbSURMQXR0cnNbaV1dID09PSBudWxsKSA/
ICItLW51bGwgbGl0ZXJhbC0tIiA6ICInIiArIGVsZW1lbnRbSURMQXR0cnNbaV1dKSArICInIjsN
CiAgICAgICAgICAgICAgICBjbG9uZS5jaGlsZHJlblszXS5pbm5lckhUTUwgPSBjb250ZW50QXR0
cnNbaV07DQogICAgICAgICAgICAgICAgY2xvbmUuY2hpbGRyZW5bNF0uaW5uZXJIVE1MID0gKGVs
ZW1lbnQuaGFzQXR0cmlidXRlKGNvbnRlbnRBdHRyc1tpXSkgPyAiJyIgKyBlbGVtZW50LmdldEF0
dHJpYnV0ZShjb250ZW50QXR0cnNbaV0pICsgIiciIDogIi0tYXR0cmlidXRlIG5vdCBzZXQtLSIp
Ow0KICAgICAgICAgICAgICAgIGNsb25lVGVtcGxhdGUucGFyZW50Tm9kZS5hcHBlbmRDaGlsZChj
bG9uZSk7DQogICAgICAgICAgICB9DQogICAgICAgIH0NCg0KICAgIDwvc2NyaXB0Pg0KDQo8L2Jv
ZHk+DQo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>