Skip to content
Permalink
Browse files

[] (0) WF2: <input type=file> and some editorial fallout.

git-svn-id: http://svn.whatwg.org/webapps@2274 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Oct 3, 2008
1 parent 64a8bdf commit 5b317b4e6c4a3f42216640414e5cde6658cce72e
Showing with 154 additions and 97 deletions.
  1. +73 −47 index
  2. +81 −50 source
120 index
@@ -517,7 +517,7 @@
<li><a href=#range-state><span class=secno>4.10.4.1.13 </span>Range state</a></li>
<li><a href=#checkbox-state><span class=secno>4.10.4.1.14 </span>Checkbox state</a></li>
<li><a href=#radio-button-state><span class=secno>4.10.4.1.15 </span>Radio Button state</a></li>
<li><a href=#file-state><span class=secno>4.10.4.1.16 </span>File state</a></li>
<li><a href=#file-upload-state><span class=secno>4.10.4.1.16 </span>File Upload state</a></li>
<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>
<td> An enumerated value
<td> A radio button
<tr><td> <dfn id=attr-input-type-file-keyword title=attr-input-type-file-keyword><code>file</code></dfn>
<td> <a href=#file-state title=attr-input-type-file>File</a>
<td> <a href=#file-upload-state title=attr-input-type-file>File Upload</a>
<td> Zero or more files each with a MIME type and optionally a file name
<td> A label and a button
<tr><td> <dfn id=attr-input-type-submit-keyword title=attr-input-type-submit-keyword><code>submit</code></dfn>
<th> <span><a href=#range-state title=attr-input-type-range>Range</a></span>
<th> <span><a href=#checkbox-state title=attr-input-type-checkbox>Checkbox</a>,</span>
<span><a href=#radio-button-state title=attr-input-type-radio>Radio Button</a></span>
<th> <span><a href=#file-state title=attr-input-type-file>File</a></span>
<th> <span><a href=#file-upload-state title=attr-input-type-file>File Upload</a></span>
<th> <span><a href=#submit-button-state title=attr-input-type-submit>Submit Button</a></span>
<th> <span><a href=#image-button-state title=attr-input-type-image>Image Button</a></span>
<th> <span><a href=#reset-button-state title=attr-input-type-reset>Reset Button</a>,</span>
</table><p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute changes state, and
when the element is first created, the element's rendering and
behaviour must change to the new state's accordingly and the
<dfn id=value-sanitization-algorithm>value sanitization algorithm</dfn> defined for the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's new state must be
invoked.</p>
<dfn id=value-sanitization-algorithm>value sanitization algorithm</dfn>, if one is defined for the
<code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's new state,
must be invoked.</p>

<p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-value title=concept-fe-value>value</a>, which is exposed by the <code title=dom-input-value><a href=#dom-input-value>value</a></code> DOM attribute. Some states
define an <dfn id=concept-input-value-string-number title=concept-input-value-string-number>algorithm
have a <i title=concept-input-value-dirty><a href=#concept-input-value-dirty>dirty value</a></i>, the
user agent must set the <a href=#concept-fe-value title=concept-fe-value>value</a>
of the element to the value of the <code title=attr-input-value><a href=#attr-input-value>value</a></code> content attribute, if there is
one, or the empty string otherwise, and run the <a href=#value-sanitization-algorithm>value
sanitization algorithm</a>.</p>
one, or the empty string otherwise, and then run the current
<a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if one is defined.</p>

<p>Each <code><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a>, which is exposed by
the <code title=dom-input-checked><a href=#dom-input-checked>checked</a></code> DOM
if there is one, or the empty string otherwise, set the <a href=#concept-fe-checked title=concept-fe-checked>checkedness</a> of the element to true
if the element has a <code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>
content attribute and false if it does not, and then invoke the
<a href=#value-sanitization-algorithm>value sanitization algorithm</a> defined for the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state.</p>
<a href=#value-sanitization-algorithm>value sanitization algorithm</a>, if the <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
defines one.</p>

<p>Each <code><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-mutability title=concept-input-mutability>mutability flag</dfn>. When it is
true, the element is said to be <dfn id=concept-input-mutable title=concept-input-mutable><i>mutable</i></dfn>, and when it is
the <a href=#hidden-state title=attr-input-type-hidden>Hidden</a> state, it is
<a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p>If the <code title=attr-input-value><a href=#attr-input-value>name</a></code> attribute is
present and has a value that is a <a href=#case-sensitive>case-sensitive</a> match
for the string "<code title="">_charset_</code>", then the element's

<!-- XXX event timing; activation behavior -->

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p>The following common <code><a href=#the-input-element>input</a></code> element content
attributes and DOM attributes apply to the element:
<code title=attr-input-checked><a href=#attr-input-checked>checked</a></code>, and

<!-- XXX event timing; activation behavior -->

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p>The following common <code><a href=#the-input-element>input</a></code> element content
attributes and DOM attributes apply to the element:
<code title=attr-input-checked><a href=#attr-input-checked>checked</a></code> and



<h6 id=file-state><span class=secno>4.10.4.1.16 </span><dfn title=attr-input-type-file>File</dfn> state</h6>
<h6 id=file-upload-state><span class=secno>4.10.4.1.16 </span><dfn title=attr-input-type-file>File Upload</dfn> state</h6>

<p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-state title=attr-input-type-file>File</a> state, the rules in this
<p>When an <code><a href=#the-input-element>input</a></code> element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, the rules in this
section apply.</p>

<p class=XXX>...</p>
<p>The <code><a href=#the-input-element>input</a></code> element represents a list of <dfn id=concept-input-type-file-selected title=concept-input-type-file-selected>selected files</dfn>, each
file consisting of a file name, a file type, and a file body (the
contents of the file).</p>

<p>The element's <code title=attr-input-value><a href=#attr-input-value>value</a></code>
attribute must be omitted.</p>
<p>If the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>,
the user should allow the user to change the files on the list,
e.g. adding or removing files. Files can be from the filesystem or
created on the fly, e.g. a picture taken from a camera connected to
the user's device.</p>

<p>The <dfn id=attr-input-accept title=attr-input-accept><code>accept</code></dfn>
<p><strong>Constraint validation:</strong> If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> is
empty, then the element is <a href=#suffering-from-being-missing>suffering from being
missing</a>.</p>

<p>There must be no more than one file in the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a>.</p>

<hr><p>The <dfn id=attr-input-accept 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>


<dd>Indicates that files of the specified type are accepted. <a href=#refsRFC2046>RFC[2046]</a></dd>

</dl><p>The values must not be <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
matches for any of the other values (i.e. duplicates are not
</dl><p>The tokens must not be <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
matches for any of the other tokens (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>User agents should prevent the user from selecting files that are
not accepted by one (or more) of these tokens.</p>

<p class=XXX>... list of <dfn id=concept-input-type-file-selected title=concept-input-type-file-selected>selected files</dfn></p>
<hr><p>The following common <code><a href=#the-input-element>input</a></code> element content
attributes apply to the element:
<code title=attr-input-accept><a href=#attr-input-accept>accept</a></code> and
<code title=attr-input-required><a href=#attr-input-required>required</a></code>.</p>

<p>The following content attributes must not be specified and do not
apply to the element:
<code class=no-backref title=attr-fs-action><a href=#attr-fs-action>action</a></code>,
<code class=no-backref title=attr-input-alt><a href=#attr-input-alt>alt</a></code>,
<code class=no-backref title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>,
<code class=no-backref title=attr-input-checked><a href=#attr-input-checked>checked</a></code>,
<code class=no-backref title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>,
<code class=no-backref title=attr-input-list><a href=#attr-input-list>list</a></code>,
<code class=no-backref title=attr-input-max><a href=#attr-input-max>max</a></code>,
<code class=no-backref title=attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>,
<code class=no-backref title=attr-fs-method><a href=#attr-fs-method>method</a></code>,
<code class=no-backref title=attr-input-min><a href=#attr-input-min>min</a></code>,
<code class=no-backref title=attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>,
<code class=no-backref title=attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>,
<code class=no-backref title=attr-input-size><a href=#attr-input-size>size</a></code>,
<code class=no-backref title=attr-input-src><a href=#attr-input-src>src</a></code>,
<code class=no-backref title=attr-input-step><a href=#attr-input-step>step</a></code>, and
<code class=no-backref title=attr-fs-target><a href=#attr-fs-target>target</a></code>.</p>

<p>The following DOM attributes and methods do not apply to the element:
<code class=no-backref title=dom-input-checked><a href=#dom-input-checked>checked</a></code>,
<code class=no-backref title=dom-input-list><a href=#dom-input-list>list</a></code>,
<code class=no-backref title=dom-input-selectedOption><a href=#dom-input-selectedoption>selectedOption</a></code>,
<code class=no-backref title=dom-input-value><a href=#dom-input-value>value</a></code>,
<code class=no-backref title=dom-input-valueAsDate><a href=#dom-input-valueasdate>valueAsDate</a></code> and
<code class=no-backref title=dom-input-valueAsNumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> DOM attributes;
<code class=no-backref title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and
<code class=no-backref title=dom-input-stepUp><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>

<p><strong>Constraint validation:</strong> If the element is <i title=concept-input-required><a href=#concept-input-required>required</a></i> and the list of <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected files</a> is
empty, then the element is <a href=#suffering-from-being-missing>suffering from being
missing</a>.</p>



owner</a>, the element must <a href=#concept-form-submit title=concept-form-submit>submit</a> the <a href=#form-owner>form
owner</a> from the <code><a href=#the-input-element>input</a></code> element.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p>The following common <code><a href=#the-input-element>input</a></code> element content
attributes and DOM attributes apply to the element:
<code title=attr-fs-action><a href=#attr-fs-action>action</a></code>,
owner</a>, the element must <a href=#concept-form-reset title=concept-form-reset>reset</a> the <a href=#form-owner>form
owner</a>.</p>

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p><strong>Constraint validation:</strong> The element is
<a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>


<!-- XXX event timing; activation behavior -->

<p><strong>The <a href=#value-sanitization-algorithm>value sanitization algorithm</a> is as
follows:</strong> Do nothing.</p>

<p><strong>Constraint validation:</strong> The element is
<a href=#barred-from-constraint-validation>barred from constraint validation</a>.</p>

it must set the element's <a href=#concept-fe-value title=concept-fe-value>value</a> to the new value, set the
element's <a href=#concept-input-value-dirty-flag title=concept-input-value-dirty-flag>dirty value
flag</a> to true, and then invoke the <a href=#value-sanitization-algorithm>value sanitization
algorithm</a> defined for the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state.</dd>
algorithm</a>, if the element's <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state
defines one.</dd>

<dt><dfn id=dom-input-value-default title=dom-input-value-default>default</dfn>


<p>Attributes for form submission can be specified both on
<code><a href=#the-form-element>form</a></code> elements and on elements that represent buttons
that submit forms, e.g. an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <span title=attr-input-type-submit-state>Submit Button</span> state. The
that submit forms, e.g. an <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#submit-button-state title=attr-input-type-submit>Submit Button</a> state. The
attributes on the buttons, when omitted, default to the values given
on the corresponding the <code><a href=#the-form-element>form</a></code> element.</p>

false.</li>

<li>The <var title="">field</var> element is an
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <span title=attr-input-type-file-state>File Upload</span> state but
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state but
the control does not have any files selected.</li>

</ul><p>Otherwise, process <var title="">field</var> as follows:</p>
<li>

<p>If the <var title="">field</var> element is an
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <span title=attr-input-type-image-state>Image Button</span> state,
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#image-button-state title=attr-input-type-image>Image Button</a> state,
then run these further nested substeps:</p>

<ol><li><p>If the <var title="">field</var> element has an <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute specified and value
</ol></li>

<li><p>Otherwise, if the <var title="">field</var> element is an
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <span title=attr-input-type-file-state>File Upload</span> state, then
for each file <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected</a> in the
<code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, then for
each file <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected</a> in the
<code><a href=#the-input-element>input</a></code> element, append an entry in the <var title="">form data set</var> with the <var title="">name</var> as
the name and the file as the value. (Both the file name and the
file contents are subsequently used.)</li>
the name and the file (consisting of the name, the type, and the
body) as the value.</li>

<li><p>Otherwise, append an entry in the <var title="">form data
set</var> with <var title="">name</var> as the name and the <a href=#concept-fe-value title=concept-fe-value>value</a> of the <var title="">field</var> element as the value.</li>

0 comments on commit 5b317b4

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