HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2311WF2: <textarea maxlength>; also, factoring out common stuff for this from <input> to reduce duplication.2008-10-09 23:57
@@ -1026,20 +1026,21 @@
 
   <!-- XXX need to define how to handle U+000A LINE FEED and U+000D
   CARRIAGE RETURN in attributes (for HTML) -->
 
   <p class="XXX">Need to go through the whole spec and make sure
   all the attribute values are clearly defined either in terms of
   microsyntaxes or in terms of other specs, or as "Text" or some
   such.</p>
 
 
+
   <h4>Common parser idioms</h4>
 
   <p>The <dfn title="space character">space characters</dfn>, for the
   purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER
   TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
   U+000D CARRIAGE RETURN (CR).</p>
 
   <p>The <dfn title="White_Space">White_Space characters</dfn> are
   those that have the Unicode property "White_Space". <a
   href="#refsUNICODE">[UNICODE]</a></p>
@@ -1075,20 +1076,28 @@
   </ol>
 
   <p>The step <dfn>skip whitespace</dfn> means that the user agent
   must <span>collect a sequence of characters</span> that are <span
   title="space character">space characters</span>. The step <dfn>skip
   White_Space characters</dfn> means that the user agent must
   <span>collect a sequence of characters</span> that are
   <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>
 
   <p>A number of attributes in HTML5 are <dfn title="boolean
   attribute">boolean attributes</dfn>. The presence of a boolean
   attribute on an element represents the true value, and the absence
   of the attribute represents the false value.</p>
 
   <p>If the attribute is present, its value must either be the empty
   string or a value that is an <span>ASCII case-insensitive</span>
@@ -26649,21 +26658,22 @@ function AddCloud(data, x, y) { ... }</pre>
   edit control for the element's <span
   title="concept-fe-value">value</span>.</p>
 
   <p>If the element is <i title="concept-input-mutable">mutable</i>,
   its <span title="concept-fe-value">value</span> should be editable
   by the user. User agents must not allow users to insert U+000A LINE
   FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the
   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">
 
    <p>The following common <code>input</code> element content
    attributes and DOM attributes apply to the element:
    <code title="attr-input-autocomplete">autocomplete</code>,
    <code title="attr-input-list">list</code>,
    <code title="attr-input-maxlength">maxlength</code>,
    <code title="attr-input-pattern">pattern</code>,
    <code title="attr-input-readonly">readonly</code>,
@@ -26720,21 +26730,22 @@ function AddCloud(data, x, y) { ... }</pre>
   represented by its <span title="concept-fe-value">value</span>. User
   agents may allow the user to set the <span
   title="concept-fe-value">value</span> to a string that is not an
   e-mail address. User agents should allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string. User
   agents must not allow users to insert U+000A LINE FEED (LF) or
   U+000D CARRIAGE RETURN (CR) characters into the <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>
 
   <p><strong>Constraint validation:</strong> While the <span
   title="concept-fe-value">value</span> of the element does not match
   the <code>addr-spec</code> token defined in RFC 2822 section 3.4.1,
   excluding the <code>CFWS</code> subtoken everywhere, and excluding
   the <code>FWS</code> subtoken everywhere except in the
   <code>quoted-string</code> subtoken, the element is <span>suffering
   from a type mismatch</span>. <a
   href="#refsRFC2822">[RFC2822]</a></p>
 
@@ -26800,21 +26811,22 @@ function AddCloud(data, x, y) { ... }</pre>
   <span title="concept-fe-value">value</span>. User agents may allow
   the user to set the <span title="concept-fe-value">value</span> to a
   string that is not a <span>valid URL</span>. User agents should
   allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string. User
   agents must not allow users to insert U+000A LINE FEED (LF) or
   U+000D CARRIAGE RETURN (CR) characters into the <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>
 
   <p><strong>Constraint validation:</strong> While the <span
   title="concept-fe-value">value</span> of the element is not a
   <span>valid URL</span>, the element is <span>suffering from a type
   mismatch</span>.</p>
 
   <div class="bookkeeping">
 
    <p>The following common <code>input</code> element content
    attributes and DOM attributes apply to the element:
@@ -26872,21 +26884,22 @@ function AddCloud(data, x, y) { ... }</pre>
   title="concept-fe-value">value</span>. The user agent should obscure
   the value so that people other than the user cannot see it.</p>
 
   <p>If the element is <i title="concept-input-mutable">mutable</i>,
   its <span title="concept-fe-value">value</span> should be editable
   by the user. User agents must not allow users to insert U+000A LINE
   FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <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">
 
    <p>The following common <code>input</code> element content
    attributes and DOM attributes apply to the element:
    <code title="attr-input-autocomplete">autocomplete</code>,
    <code title="attr-input-maxlength">maxlength</code>,
    <code title="attr-input-pattern">pattern</code>,
    <code title="attr-input-readonly">readonly</code>,
    <code title="attr-input-required">required</code>, and
@@ -28699,28 +28712,20 @@ function AddCloud(data, x, y) { ... }</pre>
    <code class="no-backref" title="dom-input-stepUp">stepUp()</code> methods.</p>
 
    <p>The <code class="no-backref"
    title="event-input-input">input</code> and <code class="no-backref"
    title="event-input-change">change</code> events do not fire.</p>
 
   </div>
 
 
 
-  <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>
 
   <p>These attributes only apply to an <code>input</code> element if
   its <code title="attr-input-type">type</code> attribute is in a
   state whose definition declares that the attribute applies. When an
   attribute doesn't apply to an <code>input</code> element, user
   agents must <span>ignore</span> the attribute.</p>
 
 
@@ -28902,54 +28907,32 @@ function AddCloud(data, x, y) { ... }</pre>
   the mode <span title="dom-input-value-value">value</span>, and the
   element's <span title="concept-fe-value">value</span> is the empty
   string, then the element is <span>suffering from being
   missing</span>.</p>
 
 
 
   <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>
 
   <p>The <dfn title="attr-input-pattern"><code>pattern</code></dfn>
   attribute specifies a regular expression against which the control's
   <span title="concept-fe-value">value</span> is to be checked.</p>
 
   <p>If specified, the attribute's value must match the <i
   title="">Pattern</i> production of ECMA 262's grammar. <a
@@ -30245,21 +30228,33 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
    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>
+  <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>
 
   <p class="XXX"> ... <dfn title="attr-textarea-accept"><code>accept</code></dfn>
 
   <p>The <code title="attr-fae-form">form</code> attribute is used to
   explicitly associate the <code>textarea</code> element with its
   <span>form owner</span>. The <code title="attr-fe-name">name</code>
   attribute represents the element's name. The <code
   title="attr-fe-disabled">disabled</code> attribute is used to make
@@ -30546,20 +30541,51 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
   same name.</p>
 
   <div class="example">
    <p>In the following snippet, the text control would be focused when
    the document was loaded.</p>
    <pre>&lt;input maxlength="256" name="q" value="" autofocus&gt;
 &lt;input type="submit" value="Search"&gt;</pre>
   </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>
 
   <p class="XXX">... <dfn title="attr-fs-action">action</dfn> content attribute</p>
 
   <p class="XXX">... <dfn title="dom-fs-action">action</dfn> DOM attribute</p>
 
   <p class="XXX">... <dfn title="concept-fs-action">action</dfn> if present else form's else default</p>
   <!-- XXX mozilla bug 297761 -->
 

|