[html5] r2226 - [] (0) WF2: define the syntax of <input type=file accept='...'>

whatwg at whatwg.org whatwg at whatwg.org
Tue Sep 23 18:52:49 PDT 2008


Author: ianh
Date: 2008-09-23 18:52:49 -0700 (Tue, 23 Sep 2008)
New Revision: 2226

Modified:
   index
   source
Log:
[] (0) WF2: define the syntax of <input type=file accept='...'>

Modified: index
===================================================================
--- index	2008-09-23 00:13:21 UTC (rev 2225)
+++ index	2008-09-24 01:52:49 UTC (rev 2226)
@@ -29,7 +29,7 @@
 
    <h1 id=html-5>HTML 5</h1>
 
-   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 23
+   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 24
     September 2008</h2>
 
    <p>You can take part in this work. <a
@@ -353,12 +353,16 @@
        <li><a href="#time-offsets"><span class=secno>2.4.5 </span>Time
         offsets</a>
 
-       <li><a href="#tokens"><span class=secno>2.4.6 </span>Tokens</a>
+       <li><a href="#space-separated"><span class=secno>2.4.6
+        </span>Space-separated tokens</a>
 
-       <li><a href="#keywords"><span class=secno>2.4.7 </span>Keywords and
+       <li><a href="#comma-separated"><span class=secno>2.4.7
+        </span>Comma-separated tokens</a>
+
+       <li><a href="#keywords"><span class=secno>2.4.8 </span>Keywords and
         enumerated attributes</a>
 
-       <li><a href="#syntax-references"><span class=secno>2.4.8
+       <li><a href="#syntax-references"><span class=secno>2.4.9
         </span>References</a>
       </ul>
 
@@ -4730,7 +4734,8 @@
    offset serialization rules</dfn>; in the format "5d4h3m2s1ms" or "3m 9.2s"
    or "00:00:00.00" or similar.
 
-  <h4 id=tokens><span class=secno>2.4.6 </span>Tokens</h4>
+  <h4 id=space-separated><span class=secno>2.4.6 </span>Space-separated
+   tokens</h4>
 
   <p>A <dfn id=set-of>set of space-separated tokens</dfn> is a set of zero or
    more words separated by one or more <a href="#space" title="space
@@ -4874,7 +4879,61 @@
    to a single space, except at the start and end of the string, where such
    spaces are removed.
 
-  <h4 id=keywords><span class=secno>2.4.7 </span>Keywords and enumerated
+  <h4 id=comma-separated><span class=secno>2.4.7 </span>Comma-separated
+   tokens</h4>
+
+  <p>A <dfn id=set-of0>set of comma-separated tokens</dfn> is a set of zero
+   or more tokens each separated from the next by a single U+002C COMMA
+   character (<code title="">,</code>), where tokens consist of any string of
+   zero or more characters, none of which are U+002C COMMA characters (<code
+   title="">,</code>).
+
+  <p><a href="#set-of0" title="set of comma-separated tokens">Sets of
+   comma-separated tokens</a> sometimes have further restrictions on what
+   consists a valid token. When such restrictions are defined, the tokens
+   must all fit within those restrictions; other values are non-conforming.
+   If no such restrictions are specified, then all values are conforming.
+
+  <p>When a user agent has to <dfn id=split0>split a string on commas</dfn>,
+   it must use the following algorithm:
+
+  <ol>
+   <li>
+    <p>Let <var title="">input</var> be the string being parsed.
+
+   <li>
+    <p>Let <var title="">position</var> be a pointer into <var
+     title="">input</var>, initially pointing at the start of the string.
+
+   <li>
+    <p>Let <var title="">tokens</var> be a list of tokens, initially empty.
+
+   <li>
+    <p><i>Token</i>: If <var title="">position</var> is past the end of <var
+     title="">input</var>, jump to the last step.
+
+   <li>
+    <p><a href="#collect">Collect a sequence of characters</a> that are not
+     U+002C COMMA characters (<code title="">,</code>).
+
+   <li>
+    <p>Add the string collected in the previous step (which might be the
+     empty string) to <var title="">tokens</var>.
+
+   <li>
+    <p>If <var title="">position</var> is not past the end of <var
+     title="">input</var>, then the character at <var title="">position</var>
+     is a U+002C COMMA character (<code title="">,</code>); advance <var
+     title="">position</var> past that character.
+
+   <li>
+    <p>Jump back to the step labeled <i>token</i>.
+
+   <li>
+    <p>Return <var title="">tokens</var>.
+  </ol>
+
+  <h4 id=keywords><span class=secno>2.4.8 </span>Keywords and enumerated
    attributes</h4>
 
   <p>Some attributes are defined as taking one of a finite set of keywords.
@@ -4918,7 +4977,7 @@
    value default</i>), but for various reasons that isn't the way this
    specification actually defines it.
 
-  <h4 id=syntax-references><span class=secno>2.4.8 </span>References</h4>
+  <h4 id=syntax-references><span class=secno>2.4.9 </span>References</h4>
 
   <p>A <dfn id=valid7>valid hash-name reference</dfn> to an element of type
    <var title="">type</var> is a string consisting of a U+0023 NUMBER SIGN
@@ -27969,7 +28028,7 @@
 
    <dt>Element-specific attributes:
 
-   <dd><code title=attr-input-accept>accept</code>
+   <dd><code title=attr-input-accept><a href="#accept0">accept</a></code>
 
    <dd><code title=attr-fs-action><a href="#action">action</a></code>
 
@@ -28307,9 +28366,10 @@
   <p>The <i>missing value default</i> is the <a href="#text3"
    title=attr-input-type-text>Text</a> state.
 
-  <p>Which of the <code title=attr-input-accept>accept</code>, <code
-   title=attr-fs-action><a href="#action">action</a></code>, <code
-   title=attr-input-alt>alt</code>, <code title=attr-input-autocomplete><a
+  <p>Which of the <code title=attr-input-accept><a
+   href="#accept0">accept</a></code>, <code title=attr-fs-action><a
+   href="#action">action</a></code>, <code title=attr-input-alt>alt</code>,
+   <code title=attr-input-autocomplete><a
    href="#autocomplete0">autocomplete</a></code>, <code
    title=attr-input-checked>checked</code>, <code title=attr-fs-enctype><a
    href="#enctype">enctype</a></code>, and <code
@@ -28387,9 +28447,10 @@
      <th> <a href="#button1" title=attr-input-type-button>Button</a>
 
    <tbody>
-    <tr>
-     <th> <code title=attr-input-accept>accept</code>
+    <tr><!-- complete -->
 
+     <th> <code title=attr-input-accept><a href="#accept0">accept</a></code>
+
      <td class=no> · <!-- Text -->
 
      <td class=no> · <!-- Password -->
@@ -28418,7 +28479,7 @@
 
      <td class=no> · <!-- Radio Button -->
 
-     <td class=no> · <!-- File -->
+     <td class=yes> Yes <!-- File -->
 
      <td class=no> · <!-- Hidden -->
 
@@ -29656,10 +29717,11 @@
    title=attr-input-type><a href="#type14">type</a></code> attribute is in
    the <a href="#text3" title=attr-input-type-text>Text</a> state, the
    following content attributes must not be specified and do not apply to the
-   element: <code class=no-backref title=attr-input-accept>accept</code>,
-   <code class=no-backref title=attr-input-alt>alt</code>, <code
-   class=no-backref title=attr-input-checked>checked</code>, <code
-   class=no-backref title=attr-input-max>max</code>, <code class=no-backref
+   element: <code class=no-backref title=attr-input-accept><a
+   href="#accept0">accept</a></code>, <code class=no-backref
+   title=attr-input-alt>alt</code>, <code class=no-backref
+   title=attr-input-checked>checked</code>, <code class=no-backref
+   title=attr-input-max>max</code>, <code class=no-backref
    title=attr-input-min>min</code>, <code class=no-backref
    title=attr-input-src>src</code>, <code class=no-backref
    title=attr-input-step>step</code>, <code class=no-backref
@@ -29748,8 +29810,8 @@
    title=attr-input-type><a href="#type14">type</a></code> attribute is in
    the <a href="#password1" title=attr-input-type-password>Password</a>
    state, the following content attributes must not be specified and do not
-   apply to the element: <code class=no-backref
-   title=attr-input-accept>accept</code>, <code class=no-backref
+   apply to the element: <code class=no-backref title=attr-input-accept><a
+   href="#accept0">accept</a></code>, <code class=no-backref
    title=attr-input-alt>alt</code>, <code class=no-backref
    title=attr-input-checked>checked</code>, <code class=no-backref
    title=attr-input-list>list</code>, <code class=no-backref
@@ -29929,9 +29991,40 @@
 
   <p class=big-issue>...
 
-  <p class=big-issue>... <dfn id=selected
-   title=concept-input-type-file-selected>selected file</dfn>
+  <p>The <dfn id=accept0 title=attr-input-accept><code>accept</code></dfn>
+   attribute may be specified to provide user agents with a hint of what file
+   types the server will be able to accept.
 
+  <p>If specified, the attribute must consist of a <a href="#set-of0">set of
+   comma-separated tokens</a>, each of which must be an <a
+   href="#ascii">ASCII case-insensitive</a> match for one of the following:
+
+  <dl>
+   <dt>The string <code title="">audio</code>
+
+   <dd>Indicates that sound files are accepted.
+
+   <dt>The string <code title="">video</code>
+
+   <dd>Indicates that video files are accepted.
+
+   <dt>The string <code title="">image</code>
+
+   <dd>Indicates that image files are accepted.
+
+   <dt>A valid MIME type, with no parameters
+
+   <dd>Indicates that files of the specified type are accepted. <a
+    href="#refsRFC2046">RFC[2046]</a>
+  </dl>
+
+  <p>The values must not be <a href="#ascii">ASCII case-insensitive</a>
+   matches for any of the other values (i.e. duplicates are not allowed).</p>
+  <!-- XXX the selected file(s) must either have the given types or be of the given category -->
+
+  <p class=big-issue>... list of <dfn id=selected
+   title=concept-input-type-file-selected>selected files</dfn>
+
   <h6 id=hidden><span class=secno>4.10.4.1.16. </span><dfn id=hidden1
    title=attr-input-type-hidden>Hidden</dfn> state</h6>
 
@@ -60930,4 +61023,8 @@
  XXX * make the text consistent about whether it is ":<em>" and
        ":<strong>" or "</em>:" and "</strong>:". Same for other
        punctuation.
+ XXX * take references to "valid mime type" / RFC2046 and make them
+       mean something. (2046 doesn't define anything like that, and
+       2045's definition doesn't really help either, since it's part
+       of something else, and doesn't mention whitespace, etc.)
 -->

Modified: source
===================================================================
--- source	2008-09-23 00:13:21 UTC (rev 2225)
+++ source	2008-09-24 01:52:49 UTC (rev 2226)
@@ -2569,7 +2569,7 @@
 
 
 
-  <h4>Tokens</h4>
+  <h4>Space-separated tokens</h4>
 
   <p>A <dfn>set of space-separated tokens</dfn> is a set of zero or
   more words separated by one or more <span title="space
@@ -2714,6 +2714,59 @@
 
 
 
+  <h4>Comma-separated tokens</h4>
+
+  <p>A <dfn>set of comma-separated tokens</dfn> is a set of zero or
+  more tokens each separated from the next by a single U+002C COMMA
+  character (<code title="">,</code>), where tokens consist of any
+  string of zero or more characters, none of which are U+002C COMMA
+  characters (<code title="">,</code>).</p>
+
+  <p><span title="set of comma-separated tokens">Sets of
+  comma-separated tokens</span> sometimes have further restrictions on
+  what consists a valid token. When such restrictions are defined, the
+  tokens must all fit within those restrictions; other values are
+  non-conforming. If no such restrictions are specified, then all
+  values are conforming.</p>
+
+  <p>When a user agent has to <dfn>split a string on commas</dfn>, it
+  must use the following algorithm:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">input</var> be the string being
+   parsed.</p></li>
+
+   <li><p>Let <var title="">position</var> be a pointer into <var
+   title="">input</var>, initially pointing at the start of the
+   string.</p></li>
+
+   <li><p>Let <var title="">tokens</var> be a list of tokens,
+   initially empty.</p></li>
+
+   <li><p><i>Token</i>: If <var title="">position</var> is past the
+   end of <var title="">input</var>, jump to the last step.</p></li>
+
+   <li><p><span>Collect a sequence of characters</span> that are not
+   U+002C COMMA characters (<code title="">,</code>).</p></li>
+
+   <li><p>Add the string collected in the previous step (which might
+   be the empty string) to <var title="">tokens</var>.</p></li>
+
+   <li><p>If <var title="">position</var> is not past the end of <var
+   title="">input</var>, then the character at <var
+   title="">position</var> is a U+002C COMMA character (<code
+   title="">,</code>); advance <var title="">position</var> past that
+   character.</p></li>
+
+   <li><p>Jump back to the step labeled <i>token</i>.</p></li>
+
+   <li><p>Return <var title="">tokens</var>.</p></li>  
+
+  </ol>
+
+
+
   <h4>Keywords and enumerated attributes</h4>
 
   <p>Some attributes are defined as taking one of a finite set of
@@ -25426,7 +25479,7 @@
      <th> <span title="attr-input-type-button">Button</span>
 
    <tbody>
-    <tr>
+    <tr><!-- complete -->
      <th> <code title="attr-input-accept">accept</code>
      <td class="no"> · <!-- Text -->
      <td class="no"> · <!-- Password -->
@@ -25442,7 +25495,7 @@
      <td class="no"> · <!-- Range -->
      <td class="no"> · <!-- Checkbox -->
      <td class="no"> · <!-- Radio Button -->
-     <td class="no"> · <!-- File -->
+     <td class="yes"> Yes <!-- File -->
      <td class="no"> · <!-- Hidden -->
      <td class="no"> · <!-- Submit Button -->
      <td class="no"> · <!-- Image Button -->
@@ -26423,10 +26476,43 @@
 
   <p class="big-issue">...</p>
 
-  <p class="big-issue">... <dfn title="concept-input-type-file-selected">selected file</dfn></p>
+  <p>The <dfn title="attr-input-accept"><code>accept</code></dfn>
+  attribute may be specified to provide user agents with a hint of
+  what file types the server will be able to accept.</p>
 
+  <p>If specified, the attribute must consist of a <span>set of
+  comma-separated tokens</span>, each of which must be an <span>ASCII
+  case-insensitive</span> match for one of the following:</p>
 
+  <dl>
 
+   <dt>The string <code title="">audio</code></dt>
+
+   <dd>Indicates that sound files are accepted.</dd>
+
+   <dt>The string <code title="">video</code></dt>
+
+   <dd>Indicates that video files are accepted.</dd>
+
+   <dt>The string <code title="">image</code></dt>
+
+   <dd>Indicates that image files are accepted.</dd>
+
+   <dt>A valid MIME type, with no parameters</dt>
+
+   <dd>Indicates that files of the specified type are accepted. <a href="#refsRFC2046">RFC[2046]</a></dd>
+
+  </dl>
+
+  <p>The values must not be <span>ASCII case-insensitive</span> matches
+  for any of the other values (i.e. duplicates are not allowed).</p>
+
+  <!-- XXX the selected file(s) must either have the given types or be of the given category -->
+
+  <p class="big-issue">... list of <dfn title="concept-input-type-file-selected">selected files</dfn></p>
+
+
+
   <h6><dfn title="attr-input-type-hidden">Hidden</dfn> state</h6>
 
   <p>When an <code>input</code> element's <code title="attr-input-type">type</code>
@@ -54717,6 +54803,10 @@
  XXX * make the text consistent about whether it is ":<em>" and
        ":<strong>" or "</em>:" and "</strong>:". Same for other
        punctuation.
+ XXX * take references to "valid mime type" / RFC2046 and make them
+       mean something. (2046 doesn't define anything like that, and
+       2045's definition doesn't really help either, since it's part
+       of something else, and doesn't mention whitespace, etc.)
 -->
 
  </body>




More information about the Commit-Watchers mailing list