Skip to content
Permalink
Browse files

[] (0) WF2: <textarea wrap=''> and related fallout.

git-svn-id: http://svn.whatwg.org/webapps@2310 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Oct 9, 2008
1 parent 8820a67 commit 6a5c6be38945d14a698399f5b3de16466f22f6d7
Showing with 140 additions and 53 deletions.
  1. +61 −26 index
  2. +79 −27 source
87 index
};</pre>
</dd>
</dl><!-- XXX add selectionStart and company --><p>The <code><a href=#the-textarea-element>textarea</a></code> element represents a multiline plain
text edit control for the element's <a href=#concept-fe-value title=concept-fe-value>value</a>. The contents of the control
represent the control's default value.</p>
text edit control for the element's <dfn id=concept-textarea-raw-value title=concept-textarea-raw-value>raw value</dfn>. The contents of
the control represent the control's default value.</p>

<p><em>Whenever</em> the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is set or changed, for
whatever reason, every occurance of a U+000D CARRIAGE RETURN (CR)
character not followed by a U+000A LINE FEED (LF) character, and
every occurance of a U+000A LINE FEED (LF) character not proceeded
by a U+000D CARRIAGE RETURN (CR) character, must be replaced the
two-character string consisting of a U+000D CARRIAGE RETURN - U+000A
LINE FEED (CRLF) character pair.</p>
<p>The <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> of
a <code><a href=#the-textarea-element>textarea</a></code> control must be initially the empty
string.</p>

<p>The <dfn id=attr-textarea-readonly title=attr-textarea-readonly><code>readonly</code></dfn> attribute
is a <a href=#boolean-attribute>boolean attribute</a> used to control whether the text
<a href=#concept-fe-disabled title=concept-fe-disabled>disabled</a> nor has a <code title=attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
specified.</p>

<p>When a <code><a href=#the-textarea-element>textarea</a></code> is <a href=#concept-textarea-mutable title=concept-textarea-mutable>mutable</a>, its <a href=#concept-fe-value title=concept-fe-value>value</a> should be editable by the
user.</p>
<p>When a <code><a href=#the-textarea-element>textarea</a></code> is <a href=#concept-textarea-mutable title=concept-textarea-mutable>mutable</a>, its <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> should be
editable by the user.</p>

<p>A <code><a href=#the-textarea-element>textarea</a></code> element has a <dfn id=concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</dfn>, which must be
initially set to false, and must be set to true whenever the user
interacts with the control in a way that changes the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>
interacts with the control in a way that changes the <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a>.</p>

<p>When the <code><a href=#the-textarea-element>textarea</a></code> element's <code><a href=#textcontent>textContent</a></code>
DOM attribute changes value, if the element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a> is false,
then the element's <a href=#concept-fe-value title=concept-fe-value>value</a> must
be set to the value of the element's <code><a href=#textcontent>textContent</a></code> DOM
attribute.</p>
then the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw
value</a> must be set to the value of the element's
<code><a href=#textcontent>textContent</a></code> DOM attribute.</p>

<p>The <a href=#concept-form-reset-control title=concept-form-reset-control>reset
algorithm</a> for <code><a href=#the-textarea-element>textarea</a></code> elements is to set the
element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the value
of the element's <code><a href=#textcontent>textContent</a></code> DOM attribute.</p>
element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>value</a> to
the value of the element's <code><a href=#textcontent>textContent</a></code> DOM
attribute.</p>

<p>The <dfn id=attr-textarea-cols title=attr-textarea-cols><code>cols</code></dfn>
attribute specifies the expected maximum number of characters per
line. If the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute
is specified, its value must be a <a href=#valid-non-negative-integer>valid non-negative
integer</a> greater than zero. If applying the <a href=#rules-for-parsing-non-negative-integers>rules for
parsing non-negative integers</a> to the attribute's value
results in a number greater than zero, then the user agent may use
that number as a hint to the user as to how many characters the
server prefers per line (e.g. for visual user agents by making the
width of the control be that many characters).</p>
results in a number greater than zero, then the element's <dfn id=attr-textarea-cols-value title=attr-textarea-cols-value>character width</dfn> is that value;
otherwise, it is 20.</p>

<p>The user agent may use the <code><a href=#the-textarea-element>textarea</a></code> element's <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character width</a> as a hint to
the user as to how many characters the server prefers per line
(e.g. for visual user agents by making the width of the control be
that many characters). In visual renderings, the user agent should
wrap the user's input in the rendering so that each line is no wider
than this number of characters.</p>

<p>The <dfn id=attr-textarea-rows title=attr-textarea-rows><code>rows</code></dfn>
attribute specifies the number of lines to show. If the <code title=attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> attribute is specified, its
value must be a <a href=#valid-non-negative-integer>valid non-negative integer</a> greater than
zero. If applying the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
integers</a> to the attribute's value results in a number greater
than zero, then visual user agents should set the height of the
control to the specified number of lines.</p>

<p class=XXX> ... <dfn id=attr-textarea-wrap title=attr-textarea-wrap><code>wrap</code></dfn>
than zero, then the element's <dfn id=attr-textarea-rows-value title=attr-textarea-rows-value>character height</dfn> is that
value; otherwise, it is 2.</p>

<p>Visual user agents should set the height of the control to the
number of lines given by <a href=#attr-textarea-rows-value title=attr-textarea-rows-value>character height</a>.</p>

<p>The <dfn id=attr-textarea-wrap title=attr-textarea-wrap><code>wrap</code></dfn>
attribute is an <a href=#enumerated-attribute>enumerated attribute</a> with two keywords
and states: the <dfn id=attr-textarea-wrap-soft title=attr-textarea-wrap-soft><code>soft</code></dfn> keyword
which maps to the <dfn id=attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</dfn> state, and the the
<dfn id=attr-textarea-wrap-hard title=attr-textarea-wrap-hard><code>hard</code></dfn> keyword
which maps to the <dfn id=attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</dfn> state. The
<i>missing value default</i> is the <a href=#attr-textarea-wrap-soft-state title=attr-textarea-wrap-soft-state>Soft</a> state.</p>

<p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code>
attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state, the <code title=attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute must be
specified.</p>

<p class=XXX> ... <dfn id=attr-textarea-maxlength title=attr-textarea-maxlength><code>maxlength</code></dfn>
<p>The element's <a href=#concept-fe-value title=concept-fe-value>value</a> is
defined to be the element's <a href=#concept-textarea-raw-value title=concept-textarea-raw-value>raw value</a> with the
following transformation applied:</p>

<ol><li><p>Replace every occurance of a U+000D CARRIAGE RETURN (CR)
character not followed by a U+000A LINE FEED (LF) character, and
every occurance of a U+000A LINE FEED (LF) character not proceeded
by a U+000D CARRIAGE RETURN (CR) character, by a two-character
string consisting of a U+000D CARRIAGE RETURN - U+000A LINE FEED
(CRLF) character pair.</li>

<li><p>If the element's <code title=attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute is in the <a href=#attr-textarea-wrap-hard-state title=attr-textarea-wrap-hard-state>Hard</a> state, insert
U+000D CARRIAGE RETURN - U+000A LINE FEED (CRLF) character pairs
into the string using a UA-defined algorithm so that each line so
that each line has no more than <a href=#attr-textarea-cols-value title=attr-textarea-cols-value>character width</a>
characters. The the purposes of this requirement, lines are
delimited by the start of the string, the end of the string, and
U+000D CARRIAGE RETURN - U+000A LINE FEED (CRLF) character
pairs.</li>

</ol><p class=XXX> ... <dfn id=attr-textarea-maxlength title=attr-textarea-maxlength><code>maxlength</code></dfn>

<p class=XXX> ... <dfn id=attr-textarea-required title=attr-textarea-required><code>required</code></dfn>

106 source
<!-- XXX add selectionStart and company -->

<p>The <code>textarea</code> element represents a multiline plain
text edit control for the element's <span
title="concept-fe-value">value</span>. The contents of the control
represent the control's default value.</p>

<p><em>Whenever</em> the element's <span
title="concept-fe-value">value</span> is set or changed, for
whatever reason, every occurance of a U+000D CARRIAGE RETURN (CR)
character not followed by a U+000A LINE FEED (LF) character, and
every occurance of a U+000A LINE FEED (LF) character not proceeded
by a U+000D CARRIAGE RETURN (CR) character, must be replaced the
two-character string consisting of a U+000D CARRIAGE RETURN - U+000A
LINE FEED (CRLF) character pair.</p>
text edit control for the element's <dfn
title="concept-textarea-raw-value">raw value</dfn>. The contents of
the control represent the control's default value.</p>

<p>The <span title="concept-textarea-raw-value">raw value</span> of
a <code>textarea</code> control must be initially the empty
string.</p>

<p>The <dfn
title="attr-textarea-readonly"><code>readonly</code></dfn> attribute

<p>When a <code>textarea</code> is <span
title="concept-textarea-mutable">mutable</span>, its <span
title="concept-fe-value">value</span> should be editable by the
user.</p>
title="concept-textarea-raw-value">raw value</span> should be
editable by the user.</p>

<p>A <code>textarea</code> element has a <dfn
title="concept-textarea-dirty">dirty value flag</dfn>, which must be
initially set to false, and must be set to true whenever the user
interacts with the control in a way that changes the <span
title="concept-fe-value">value</span>.</p>
title="concept-textarea-raw-value">raw value</span>.</p>

<p>When the <code>textarea</code> element's <code>textContent</code>
DOM attribute changes value, if the element's <span
title="concept-textarea-dirty">dirty value flag</span> is false,
then the element's <span title="concept-fe-value">value</span> must
be set to the value of the element's <code>textContent</code> DOM
attribute.</p>
then the element's <span title="concept-textarea-raw-value">raw
value</span> must be set to the value of the element's
<code>textContent</code> DOM attribute.</p>

<p>The <span title="concept-form-reset-control">reset
algorithm</span> for <code>textarea</code> elements is to set the
element's <span title="concept-fe-value">value</span> to the value
of the element's <code>textContent</code> DOM attribute.</p>
element's <span title="concept-textarea-raw-value">value</span> to
the value of the element's <code>textContent</code> DOM
attribute.</p>

<p>The <dfn title="attr-textarea-cols"><code>cols</code></dfn>
attribute specifies the expected maximum number of characters per
line. If the <code title="attr-textarea-cols">cols</code> attribute
is specified, its value must be a <span>valid non-negative
integer</span> greater than zero. If applying the <span>rules for
parsing non-negative integers</span> to the attribute's value
results in a number greater than zero, then the user agent may use
that number as a hint to the user as to how many characters the
server prefers per line (e.g. for visual user agents by making the
width of the control be that many characters).</p>
results in a number greater than zero, then the element's <dfn
title="attr-textarea-cols-value">character width</dfn> is that value;
otherwise, it is 20.</p>

<p>The user agent may use the <code>textarea</code> element's <span
title="attr-textarea-cols-value">character width</span> as a hint to
the user as to how many characters the server prefers per line
(e.g. for visual user agents by making the width of the control be
that many characters). In visual renderings, the user agent should
wrap the user's input in the rendering so that each line is no wider
than this number of characters.</p>

<p>The <dfn title="attr-textarea-rows"><code>rows</code></dfn>
attribute specifies the number of lines to show. If the <code
title="attr-textarea-rows">rows</code> attribute is specified, its
value must be a <span>valid non-negative integer</span> greater than
zero. If applying the <span>rules for parsing non-negative
integers</span> to the attribute's value results in a number greater
than zero, then visual user agents should set the height of the
control to the specified number of lines.</p>
than zero, then the element's <dfn
title="attr-textarea-rows-value">character height</dfn> is that
value; otherwise, it is 2.</p>

<p>Visual user agents should set the height of the control to the
number of lines given by <span
title="attr-textarea-rows-value">character height</span>.</p>

<p>The <dfn title="attr-textarea-wrap"><code>wrap</code></dfn>
attribute is an <span>enumerated attribute</span> with two keywords
and states: the <dfn
title="attr-textarea-wrap-soft"><code>soft</code></dfn> keyword
which maps to the <dfn
title="attr-textarea-wrap-soft-state">Soft</dfn> state, and the the
<dfn title="attr-textarea-wrap-hard"><code>hard</code></dfn> keyword
which maps to the <dfn
title="attr-textarea-wrap-hard-state">Hard</dfn> state. The
<i>missing value default</i> is the <span
title="attr-textarea-wrap-soft-state">Soft</span> state.</p>

<p>If the element's <code title="attr-textarea-wrap">wrap</code>
attribute is in the <span
title="attr-textarea-wrap-hard-state">Hard</span> state, the <code
title="attr-textarea-cols">cols</code> attribute must be
specified.</p>

<p class="XXX"> ... <dfn title="attr-textarea-wrap"><code>wrap</code></dfn>
<p>The element's <span title="concept-fe-value">value</span> is
defined to be the element's <span
title="concept-textarea-raw-value">raw value</span> with the
following transformation applied:</p>

<ol>

<li><p>Replace every occurance of a U+000D CARRIAGE RETURN (CR)
character not followed by a U+000A LINE FEED (LF) character, and
every occurance of a U+000A LINE FEED (LF) character not proceeded
by a U+000D CARRIAGE RETURN (CR) character, by a two-character
string consisting of a U+000D CARRIAGE RETURN - U+000A LINE FEED
(CRLF) character pair.</p></li>

<li><p>If the element's <code
title="attr-textarea-wrap">wrap</code> attribute is in the <span
title="attr-textarea-wrap-hard-state">Hard</span> state, insert
U+000D CARRIAGE RETURN - U+000A LINE FEED (CRLF) character pairs
into the string using a UA-defined algorithm so that each line so
that each line has no more than <span
title="attr-textarea-cols-value">character width</span>
characters. The the purposes of this requirement, lines are
delimited by the start of the string, the end of the string, and
U+000D CARRIAGE RETURN - U+000A LINE FEED (CRLF) character
pairs.</p></li>

</ol>

<p class="XXX"> ... <dfn title="attr-textarea-maxlength"><code>maxlength</code></dfn>

0 comments on commit 6a5c6be

Please sign in to comment.
You can’t perform that action at this time.