Skip to content

Commit

Permalink
[] (0) WF2: <textarea maxlength>; also, factoring out common stuff fo…
Browse files Browse the repository at this point in the history
…r this from <input> to reduce duplication.

git-svn-id: http://svn.whatwg.org/webapps@2311 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 9, 2008
1 parent 6a5c6be commit fe99512
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 79 deletions.
95 changes: 56 additions & 39 deletions index
Expand Up @@ -521,8 +521,7 @@
<li><a href=#submit-button-state><span class=secno>4.10.4.1.17 </span>Submit Button state</a></li>
<li><a href=#image-button-state><span class=secno>4.10.4.1.18 </span>Image Button state</a></li>
<li><a href=#reset-button-state><span class=secno>4.10.4.1.19 </span>Reset Button state</a></li>
<li><a href=#button-state><span class=secno>4.10.4.1.20 </span>Button state</a></li>
<li><a href=#common-algorithms><span class=secno>4.10.4.1.21 </span>Common algorithms</a></ol></li>
<li><a href=#button-state><span class=secno>4.10.4.1.20 </span>Button state</a></ol></li>
<li><a href=#common-input-element-attributes><span class=secno>4.10.4.2 </span>Common <code>input</code> element attributes</a>
<ol>
<li><a href=#the-autocomplete-attribute><span class=secno>4.10.4.2.1 </span>The <code title=attr-input-autocomplete>autocomplete</code> attribute</a></li>
Expand All @@ -549,7 +548,8 @@
<li><a href=#naming-form-controls><span class=secno>4.10.13.1 </span>Naming form controls</a></li>
<li><a href=#enabling-and-disabling-form-controls><span class=secno>4.10.13.2 </span>Enabling and disabling form controls</a></li>
<li><a href="#a-form-control's-value"><span class=secno>4.10.13.3 </span>A form control's value</a></li>
<li><a href=#autofocusing-a-form-control><span class=secno>4.10.13.4 </span>Autofocusing a form control</a></ol></li>
<li><a href=#autofocusing-a-form-control><span class=secno>4.10.13.4 </span>Autofocusing a form control</a></li>
<li><a href=#limiting-user-input-length><span class=secno>4.10.13.5 </span>Limiting user input length</a></ol></li>
<li><a href=#attributes-for-form-submission><span class=secno>4.10.14 </span>Attributes for form submission</a></li>
<li><a href=#constraints><span class=secno>4.10.15 </span>Constraints</a>
<ol>
Expand Down Expand Up @@ -1955,6 +1955,7 @@
such.</p>



<h4 id=common-parser-idioms><span class=secno>2.4.1 </span>Common parser idioms</h4>

<p>The <dfn id=space-character title="space character">space characters</dfn>, for the
Expand Down Expand Up @@ -1993,6 +1994,14 @@
<a href=#white_space>White_Space</a> characters. In both cases, the collected
characters are not used. <a href=#refsUNICODE>[UNICODE]</a></p>

<p>When a user agent is to <dfn id=strip-line-breaks>strip line breaks</dfn> from a
string, the user agent must remove any U+000A LINE FEED (LF) and
U+000D CARRIAGE RETURN (CR) characters from that string.</p>

<p>The <dfn id=codepoint-length>codepoint length</dfn> of a string is the number of
Unicode codepoints in that string.</p>



<h4 id=boolean-attributes><span class=secno>2.4.2 </span>Boolean attributes</h4>

Expand Down Expand Up @@ -23974,7 +23983,7 @@ function AddCloud(data, x, y) { ... }</pre>
element's <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> <a href=#strip-line-breaks-from-the-value>Strip line breaks from the value</a>.</p>
follows:</strong> <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<div class=bookkeeping>

Expand Down Expand Up @@ -24038,7 +24047,7 @@ function AddCloud(data, x, y) { ... }</pre>
U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> <a href=#strip-line-breaks-from-the-value>Strip line breaks from the value</a>.</p>
follows:</strong> <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>Constraint validation:</strong> While the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element does not match
the <code>addr-spec</code> token defined in RFC 2822 section 3.4.1,
Expand Down Expand Up @@ -24110,7 +24119,7 @@ function AddCloud(data, x, y) { ... }</pre>
U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> <a href=#strip-line-breaks-from-the-value>Strip line breaks from the value</a>.</p>
follows:</strong> <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>Constraint validation:</strong> While the <a href=#concept-fe-value title=concept-fe-value>value</a> of the element is not a
<a href=#valid-url>valid URL</a>, the element is <a href=#suffering-from-a-type-mismatch>suffering from a type
Expand Down Expand Up @@ -24176,7 +24185,7 @@ function AddCloud(data, x, y) { ... }</pre>
FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> <a href=#strip-line-breaks-from-the-value>Strip line breaks from the value</a>.</p>
follows:</strong> <a href=#strip-line-breaks>Strip line breaks</a> from the <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>

<div class=bookkeeping>

Expand Down Expand Up @@ -25748,13 +25757,6 @@ function AddCloud(data, x, y) { ... }</pre>



<h6 id=common-algorithms><span class=secno>4.10.4.1.21 </span>Common algorithms</h6>

<p>When a user agent is to <dfn id=strip-line-breaks-from-the-value>strip line breaks from the
value</dfn>, the user agent must remove any U+000A LINE FEED (LF)
and U+000D CARRIAGE RETURN (CR) characters from <a href=#concept-fe-value title=concept-fe-value>value</a>.</p>



<h5 id=common-input-element-attributes><span class=secno>4.10.4.2 </span>Common <code><a href=#the-input-element>input</a></code> element attributes</h5>

Expand Down Expand Up @@ -25925,37 +25927,17 @@ function AddCloud(data, x, y) { ... }</pre>

<h6 id=the-maxlength-attribute><span class=secno>4.10.4.2.6 </span>The <code title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> attribute</h6>

<p>The <dfn id=attr-input-maxlength title=attr-input-maxlength><code>maxlength</code></dfn> attribute
allows authors to specify the maximum length allowed for user
input.</p>

<p>The <dfn id=codepoint-length>codepoint length</dfn> of a string is the number of
Unicode codepoints in that string.</p>

<p>If the attribute is specified, the attribute's value must be a
<a href=#valid-non-negative-integer>valid non-negative integer</a>. If the attribute is
specified and applying the <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative
integers</a> to its value results in a number, then that number
is the element's <dfn id=maximum-allowed-value-length>maximum allowed value length</dfn>. If the
attribute is omitted or parsing its value results in an error, then
there is no <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>
<p>The <dfn id=attr-input-maxlength title=attr-input-maxlength><code>maxlength</code></dfn> attribute,
when it applies, is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control
<code title="">maxlength</code> attribute</a> controlled by the
<code><a href=#the-input-element>input</a></code> element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a>.</p>

<p>If the <code><a href=#the-input-element>input</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed
value length</a>, then the <a href=#codepoint-length>codepoint length</a> of the
value of the element's <code title=attr-input-value><a href=#attr-input-value>value</a></code>
attribute must be equal to or less than the element's <a href=#maximum-allowed-value-length>maximum
allowed value length</a>.</p>

<p><strong>Constraint validation:</strong> If an <code><a href=#the-input-element>input</a></code>
element has a <a href=#maximum-allowed-value-length>maximum allowed value length</a>, its <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value flag</a> is
false, and the <a href=#codepoint-length>codepoint length</a> of the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is greater than the element's
<a href=#maximum-allowed-value-length>maximum allowed value length</a>, then the element is
<a href=#suffering-from-being-too-long>suffering from being too long</a>.</p>

<p>User agents may prevent the user from setting the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to a value whose
<a href=#codepoint-length>codepoint length</a> is greater than the element's
<a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>



<h6 id=the-pattern-attribute><span class=secno>4.10.4.2.7 </span>The <code title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute</h6>
Expand Down Expand Up @@ -26970,7 +26952,16 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
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>
</ol><p>The <dfn id=attr-textarea-maxlength title=attr-textarea-maxlength><code>maxlength</code></dfn>
attribute is a <a href=#attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</a> controlled by the
<code><a href=#the-textarea-element>textarea</a></code> element's <a href=#concept-textarea-dirty title=concept-textarea-dirty>dirty value flag</a>.</p>

<p>If the <code><a href=#the-textarea-element>textarea</a></code> element has a <a href=#maximum-allowed-value-length>maximum allowed
value length</a>, then the element's children must be such that
the <a href=#codepoint-length>codepoint length</a> of the value of the element's
<code><a href=#textcontent>textContent</a></code> DOM attribute is equal to or less than the
element's <a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>


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

Expand Down Expand Up @@ -27230,6 +27221,32 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
</div>


<h5 id=limiting-user-input-length><span class=secno>4.10.13.5 </span>Limiting user input length</h5>

<p>A <dfn id=attr-fe-maxlength title=attr-fe-maxlength>form control <code title="">maxlength</code> attribute</dfn>, controlled by a <var title="">dirty value flag</var> declares a limit on the number of
characters a user can input.</p>

<p>If an element has its <a href=#attr-fe-maxlength title=attr-fe-maxlength>form
control <code title="">maxlength</code> attribute</a> specified,
the attribute's value must be a <a href=#valid-non-negative-integer>valid non-negative
integer</a>. If the attribute is specified and applying the
<a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to its value
results in a number, then that number is the element's <dfn id=maximum-allowed-value-length>maximum
allowed value length</dfn>. If the attribute is omitted or parsing
its value results in an error, then there is no <a href=#maximum-allowed-value-length>maximum
allowed value length</a>.</p>

<p><strong>Constraint validation:</strong> If an element has a
<a href=#maximum-allowed-value-length>maximum allowed value length</a>, and its <var title="">dirty value flag</var> is false, and the <a href=#codepoint-length>codepoint
length</a> of the element's <a href=#concept-fe-value title=concept-fe-value>value</a> is greater than the element's
<a href=#maximum-allowed-value-length>maximum allowed value length</a>, then the element is
<a href=#suffering-from-being-too-long>suffering from being too long</a>.</p>

<p>User agents may prevent the user from causing the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to be set to a value whose
<a href=#codepoint-length>codepoint length</a> is greater than the element's
<a href=#maximum-allowed-value-length>maximum allowed value length</a>.</p>



<h4 id=attributes-for-form-submission><span class=secno>4.10.14 </span><dfn>Attributes for form submission</dfn></h4>

Expand Down
106 changes: 66 additions & 40 deletions source
Expand Up @@ -1033,6 +1033,7 @@
such.</p>



<h4>Common parser idioms</h4>

<p>The <dfn title="space character">space characters</dfn>, for the
Expand Down Expand Up @@ -1082,6 +1083,14 @@
<span>White_Space</span> characters. In both cases, the collected
characters are not used. <a href="#refsUNICODE">[UNICODE]</a></p>

<p>When a user agent is to <dfn>strip line breaks</dfn> from a
string, the user agent must remove any U+000A LINE FEED (LF) and
U+000D CARRIAGE RETURN (CR) characters from that string.</p>

<p>The <dfn>codepoint length</dfn> of a string is the number of
Unicode codepoints in that string.</p>



<h4>Boolean attributes</h4>

Expand Down Expand Up @@ -26656,7 +26665,8 @@ function AddCloud(data, x, y) { ... }</pre>
element's <span title="concept-fe-value">value</span>.</p>

<p><strong>The <span>value sanitization algorithm</span> is as
follows:</strong> <span>Strip line breaks from the value</span>.</p>
follows:</strong> <span>Strip line breaks</span> from the <span
title="concept-fe-value">value</span>.</p>

<div class="bookkeeping">

Expand Down Expand Up @@ -26727,7 +26737,8 @@ function AddCloud(data, x, y) { ... }</pre>
title="concept-fe-value">value</span>.</p>

<p><strong>The <span>value sanitization algorithm</span> is as
follows:</strong> <span>Strip line breaks from the value</span>.</p>
follows:</strong> <span>Strip line breaks</span> from the <span
title="concept-fe-value">value</span>.</p>

<p><strong>Constraint validation:</strong> While the <span
title="concept-fe-value">value</span> of the element does not match
Expand Down Expand Up @@ -26807,7 +26818,8 @@ function AddCloud(data, x, y) { ... }</pre>
title="concept-fe-value">value</span>.</p>

<p><strong>The <span>value sanitization algorithm</span> is as
follows:</strong> <span>Strip line breaks from the value</span>.</p>
follows:</strong> <span>Strip line breaks</span> from the <span
title="concept-fe-value">value</span>.</p>

<p><strong>Constraint validation:</strong> While the <span
title="concept-fe-value">value</span> of the element is not a
Expand Down Expand Up @@ -26879,7 +26891,8 @@ function AddCloud(data, x, y) { ... }</pre>
title="concept-fe-value">value</span>.</p>

<p><strong>The <span>value sanitization algorithm</span> is as
follows:</strong> <span>Strip line breaks from the value</span>.</p>
follows:</strong> <span>Strip line breaks</span> from the <span
title="concept-fe-value">value</span>.</p>

<div class="bookkeeping">

Expand Down Expand Up @@ -28706,14 +28719,6 @@ function AddCloud(data, x, y) { ... }</pre>



<h6>Common algorithms</h6>

<p>When a user agent is to <dfn>strip line breaks from the
value</dfn>, the user agent must remove any U+000A LINE FEED (LF)
and U+000D CARRIAGE RETURN (CR) characters from <span
title="concept-fe-value">value</span>.</p>



<h5>Common <code>input</code> element attributes</h5>

Expand Down Expand Up @@ -28909,40 +28914,18 @@ function AddCloud(data, x, y) { ... }</pre>
<h6>The <code title="attr-input-maxlength">maxlength</code> attribute</h6>

<p>The <dfn
title="attr-input-maxlength"><code>maxlength</code></dfn> attribute
allows authors to specify the maximum length allowed for user
input.</p>

<p>The <dfn>codepoint length</dfn> of a string is the number of
Unicode codepoints in that string.</p>

<p>If the attribute is specified, the attribute's value must be a
<span>valid non-negative integer</span>. If the attribute is
specified and applying the <span>rules for parsing non-negative
integers</span> to its value results in a number, then that number
is the element's <dfn>maximum allowed value length</dfn>. If the
attribute is omitted or parsing its value results in an error, then
there is no <span>maximum allowed value length</span>.</p>
title="attr-input-maxlength"><code>maxlength</code></dfn> attribute,
when it applies, is a <span title="attr-fe-maxlength">form control
<code title="">maxlength</code> attribute</span> controlled by the
<code>input</code> element's <span
title="concept-input-value-dirty-flag">dirty value flag</span>.</p>

<p>If the <code>input</code> element has a <span>maximum allowed
value length</span>, then the <span>codepoint length</span> of the
value of the element's <code title="attr-input-value">value</code>
attribute must be equal to or less than the element's <span>maximum
allowed value length</span>.</p>

<p><strong>Constraint validation:</strong> If an <code>input</code>
element has a <span>maximum allowed value length</span>, its <span
title="concept-input-value-dirty-flag">dirty value flag</span> is
false, and the <span>codepoint length</span> of the element's <span
title="concept-fe-value">value</span> is greater than the element's
<span>maximum allowed value length</span>, then the element is
<span>suffering from being too long</span>.</p>

<p>User agents may prevent the user from setting the element's <span
title="concept-fe-value">value</span> to a value whose
<span>codepoint length</span> is greater than the element's
<span>maximum allowed value length</span>.</p>



<h6>The <code title="attr-input-pattern">pattern</code> attribute</h6>
Expand Down Expand Up @@ -30252,7 +30235,19 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {

</ol>

<p class="XXX"> ... <dfn title="attr-textarea-maxlength"><code>maxlength</code></dfn>
<p>The <dfn
title="attr-textarea-maxlength"><code>maxlength</code></dfn>
attribute is a <span title="attr-fe-maxlength">form control <code
title="">maxlength</code> attribute</span> controlled by the
<code>textarea</code> element's <span
title="concept-textarea-dirty">dirty value flag</span>.</p>

<p>If the <code>textarea</code> element has a <span>maximum allowed
value length</span>, then the element's children must be such that
the <span>codepoint length</span> of the value of the element's
<code>textContent</code> DOM attribute is equal to or less than the
element's <span>maximum allowed value length</span>.</p>


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

Expand Down Expand Up @@ -30553,6 +30548,37 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
</div>


<h5>Limiting user input length</h5>

<p>A <dfn title="attr-fe-maxlength">form control <code
title="">maxlength</code> attribute</dfn>, controlled by a <var
title="">dirty value flag</var> declares a limit on the number of
characters a user can input.</p>

<p>If an element has its <span title="attr-fe-maxlength">form
control <code title="">maxlength</code> attribute</span> specified,
the attribute's value must be a <span>valid non-negative
integer</span>. If the attribute is specified and applying the
<span>rules for parsing non-negative integers</span> to its value
results in a number, then that number is the element's <dfn>maximum
allowed value length</dfn>. If the attribute is omitted or parsing
its value results in an error, then there is no <span>maximum
allowed value length</span>.</p>

<p><strong>Constraint validation:</strong> If an element has a
<span>maximum allowed value length</span>, and its <var
title="">dirty value flag</var> is false, and the <span>codepoint
length</span> of the element's <span
title="concept-fe-value">value</span> is greater than the element's
<span>maximum allowed value length</span>, then the element is
<span>suffering from being too long</span>.</p>

<p>User agents may prevent the user from causing the element's <span
title="concept-fe-value">value</span> to be set to a value whose
<span>codepoint length</span> is greater than the element's
<span>maximum allowed value length</span>.</p>



<h4><dfn>Attributes for form submission</dfn></h4>

Expand Down

0 comments on commit fe99512

Please sign in to comment.