<?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>13983</bug_id>
          
          <creation_ts>2011-08-31 17:36:52 +0000</creation_ts>
          <short_desc>WF2: It seems like textarea&apos;s raw value should always normalize newlines to \n</short_desc>
          <delta_ts>2012-01-04 04:58:05 +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>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#concept-textarea-raw-value</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>hsteen</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>kennyluck</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>shadow2531</cc>
    
    <cc>zcorpan</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>56113</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-08-31 17:36:52 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/complete/the-button-element.html
Multipage: http://www.whatwg.org/C#concept-textarea-raw-value
Complete: http://www.whatwg.org/c#concept-textarea-raw-value

Comment:
It seems like textarea&apos;s raw value should always normalize newlines to \n (and
form submission should normalize \n to \r\n)

Posted from: 85.227.158.34 by simonp@opera.com
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.5.8; U; en) Presto/2.9.168 Version/11.50</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56180</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-09-01 13:52:27 +0000</bug_when>
    <thetext>Form submission should also normalize \n in *names* to \r\n</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56213</commentid>
    <comment_count>2</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2011-09-02 10:14:42 +0000</bug_when>
    <thetext>Simon: see http://www.w3.org/Bugs/Public/show_bug.cgi?id=12606 for newline handling when serializing for form submission.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56214</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-09-02 10:23:57 +0000</bug_when>
    <thetext>Ah, OK, that bug covers submission. Then this bug is just &quot;textarea&apos;s raw value should always normalize newlines to \n&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56230</commentid>
    <comment_count>4</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-09-02 23:39:42 +0000</bug_when>
    <thetext>This matches what Gecko does too I believe.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58586</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-20 22:19:55 +0000</bug_when>
    <thetext>Do you have a testcase demonstrating what you mean? Is this just about DOM manipulation inserting U+000Ds using .textContent and those needing to not be reflected in .value?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58587</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-20 22:34:25 +0000</bug_when>
    <thetext>http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1217 (expect \n)

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1218 here I expected \n for all of them, which webkit does. Opera currently normalizes them all to \r\n, but we&apos;ll change it to \n. Firefox changes the .value = &apos;x\r&apos; to \n, but doesn&apos;t change the others, which is a bit weird.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58859</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-25 04:51:01 +0000</bug_when>
    <thetext>Pressing enter inserts a U+000A. I don&apos;t understand where 1217 would be getting its U+000Ds.

Haven&apos;t look at 1218 in detail yet, but I&apos;m not convinced what WebKit does there is right (e.g. try it with span/textContent instead of textarea/value </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59104</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-27 21:00:47 +0000</bug_when>
    <thetext>http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1238 is a variant of 1218 that also shows the textLength (which is supposed to be post-normalisation).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59110</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-27 23:54:02 +0000</bug_when>
    <thetext>http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1240

Opera:
 - value is raw value normalised to \r\n
 - setting value sets raw value (implied)
 - textLength is based on raw value normalised to \r\n
 - textContent is not normalised

Chrome:
 - value is raw value normalised to \n
 - setting value sets raw value (implied)
 - textLength is based on raw value normalised to \n
 - textContent is not normalised

Firefox:
 - value is raw value not normalised
 - setting value normalises to \n
 - textLength is based on raw value not normalised
 - textContent is not normalised

IE9:
 - value is raw value not normalised but with \rs turned into \n
 - setting value normalises to \n
 - no textLength support
 - textContent is normalised to \n

So from this I think it would be reasonable to say:
 - value should be raw value normalised to \r\n (what is submitted)
 - setting value can set raw value (since getting it is normalised
   so it doesn&apos;t matter what the raw value really is)
 - textLength should be based on the raw value normalised to \r\n
   (again, what is submitted)
 - textContent should not be normalised (since that&apos;s a far broader
   change than just &lt;textarea&gt; if we do it)

I believe this is what the spec says now.

Are there any Web-compat reasons to do something else?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59121</commentid>
    <comment_count>10</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-28 08:04:06 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; So from this I think it would be reasonable to say:
&gt;  - value should be raw value normalised to \r\n (what is submitted)

Only Opera does this. We will change to normalize to \n.

&gt;  - setting value can set raw value (since getting it is normalised
&gt;    so it doesn&apos;t matter what the raw value really is)
&gt;  - textLength should be based on the raw value normalised to \r\n
&gt;    (again, what is submitted)

Should be normalized to \n.

&gt;  - textContent should not be normalised (since that&apos;s a far broader
&gt;    change than just &lt;textarea&gt; if we do it)
&gt; 
&gt; I believe this is what the spec says now.
&gt; 
&gt; Are there any Web-compat reasons to do something else?

Yes. We have lots of bugs on this. It breaks BBCode, apparently, where the code gets confused about the caret&apos;s position or something and inserts it&apos;s &quot;markup&quot; in the wrong place because Opera uses two characters for newlines, where other browsers used just one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59517</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-02 19:42:48 +0000</bug_when>
    <thetext>Ah, well that&apos;s good to know.

Changing this basically makes textLength useless — until now, it&apos;s been useful because it compares to maxlength=&quot;&quot;. But I guess if it equals value.length it&apos;s useless anyway.

So new proposal:
 - value should be raw value normalised to \n.
 - raw value with \n turned to \r\n is what is submitted.
 - setting value sets raw value unmodified
 - textLength returns value.length
 - textContent should not be normalised

I think this matches Chrome, more or less.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59570</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-03 17:04:15 +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.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: see comment 11</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59571</commentid>
    <comment_count>13</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-11-03 17:11:00 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6815.
Check-in comment: compat changes for &lt;textarea&gt;.value and .textLength
http://html5.org/tools/web-apps-tracker?from=6814&amp;to=6815</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>