Skip to content

Commit

Permalink
[] (0) WF2: define the syntax of <input type=file accept='...'>
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@2226 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 24, 2008
1 parent 7fd76d5 commit c67bb31
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 26 deletions.
141 changes: 119 additions & 22 deletions index
Expand Up @@ -29,7 +29,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 23
<h2 class="no-num no-toc" id=draft>Draft Recommendation &mdash; 24
September 2008</h2>

<p>You can take part in this work. <a
Expand Down Expand Up @@ -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>

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -27969,7 +28028,7 @@ function AddCloud(data, x, y) { ... }</pre>

<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>

Expand Down Expand Up @@ -28307,9 +28366,10 @@ function AddCloud(data, x, y) { ... }</pre>
<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
Expand Down Expand Up @@ -28387,8 +28447,9 @@ function AddCloud(data, x, y) { ... }</pre>
<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> &middot; <!-- Text -->

Expand Down Expand Up @@ -28418,7 +28479,7 @@ function AddCloud(data, x, y) { ... }</pre>

<td class=no> &middot; <!-- Radio Button -->

<td class=no> &middot; <!-- File -->
<td class=yes> Yes <!-- File -->

<td class=no> &middot; <!-- Hidden -->

Expand Down Expand Up @@ -29656,10 +29717,11 @@ function AddCloud(data, x, y) { ... }</pre>
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
Expand Down Expand Up @@ -29748,8 +29810,8 @@ function AddCloud(data, x, y) { ... }</pre>
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
Expand Down Expand Up @@ -29929,8 +29991,39 @@ function AddCloud(data, x, y) { ... }</pre>

<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>
Expand Down Expand Up @@ -60930,4 +61023,8 @@ TODO (or delay):
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.)
-->
98 changes: 94 additions & 4 deletions source
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -25426,7 +25479,7 @@ function AddCloud(data, x, y) { ... }</pre>
<th> <span title="attr-input-type-button">Button</span>

<tbody>
<tr>
<tr><!-- complete -->
<th> <code title="attr-input-accept">accept</code>
<td class="no"> &middot; <!-- Text -->
<td class="no"> &middot; <!-- Password -->
Expand All @@ -25442,7 +25495,7 @@ function AddCloud(data, x, y) { ... }</pre>
<td class="no"> &middot; <!-- Range -->
<td class="no"> &middot; <!-- Checkbox -->
<td class="no"> &middot; <!-- Radio Button -->
<td class="no"> &middot; <!-- File -->
<td class="yes"> Yes <!-- File -->
<td class="no"> &middot; <!-- Hidden -->
<td class="no"> &middot; <!-- Submit Button -->
<td class="no"> &middot; <!-- Image Button -->
Expand Down Expand Up @@ -26423,7 +26476,40 @@ function AddCloud(data, x, y) { ... }</pre>

<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>



Expand Down Expand Up @@ -54717,6 +54803,10 @@ TODO (or delay):
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>
Expand Down

0 comments on commit c67bb31

Please sign in to comment.