- From: poot <cvsmail@w3.org>
- Date: Thu, 03 Mar 2011 20:15:56 -0500
- To: public-html-diffs@w3.org
hixie: Abstract out an algorithm for Anne. (whatwg r5937) http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4777&r2=1.4778&f=h http://html5.org/tools/web-apps-tracker?from=5936&to=5937 =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.4777 retrieving revision 1.4778 diff -u -d -r1.4777 -r1.4778 --- Overview.html 4 Mar 2011 01:02:26 -0000 1.4777 +++ Overview.html 4 Mar 2011 01:14:36 -0000 1.4778 @@ -913,9 +913,10 @@ <li><a href="#introduction-1"><span class="secno">4.10.22.1 </span>Introduction</a></li> <li><a href="#implicit-submission"><span class="secno">4.10.22.2 </span>Implicit submission</a></li> <li><a href="#form-submission-algorithm"><span class="secno">4.10.22.3 </span>Form submission algorithm</a></li> - <li><a href="#url-encoded-form-data"><span class="secno">4.10.22.4 </span>URL-encoded form data</a></li> - <li><a href="#multipart-form-data"><span class="secno">4.10.22.5 </span>Multipart form data</a></li> - <li><a href="#plain-text-form-data"><span class="secno">4.10.22.6 </span>Plain text form data</a></ol></li> + <li><a href="#constructing-form-data-set"><span class="secno">4.10.22.4 </span>Constructing the form data set</a></li> + <li><a href="#url-encoded-form-data"><span class="secno">4.10.22.5 </span>URL-encoded form data</a></li> + <li><a href="#multipart-form-data"><span class="secno">4.10.22.6 </span>Multipart form data</a></li> + <li><a href="#plain-text-form-data"><span class="secno">4.10.22.7 </span>Plain text form data</a></ol></li> <li><a href="#resetting-a-form"><span class="secno">4.10.23 </span>Resetting a form</a></ol></li> <li><a href="#interactive-elements"><span class="secno">4.11 </span>Interactive elements</a> <ol> @@ -38410,178 +38411,8 @@ <!-- unlock --> - <li><p>Let <var title="">controls</var> be a list of all the <a href="#category-submit" title="category-submit">submittable elements</a> whose - <a href="#form-owner">form owner</a> is <var title="">form</var>, in <a href="#tree-order">tree - order</a>.</li> - - <li><p>Let the <var title="">form data set</var> be a list of - name-value-type tuples, initially empty.</li> - - <li id="constructing-form-data-set"> - - <p><strong>Constructing the form data set</strong>. For each - element <var title="">field</var> in <var title="">controls</var>, - in <a href="#tree-order">tree order</a>, run the following substeps:</p> - - <ol><li> - - <p>If any of the following conditions are met, then skip these - substeps for this element:</p> - - <ul><li>The <var title="">field</var> element has a - <code><a href="#the-datalist-element">datalist</a></code> element ancestor.</li> - - <li>The <var title="">field</var> element is <a href="#concept-fe-disabled" title="concept-fe-disabled">disabled</a>.</li> - - <li>The <var title="">field</var> element is a <a href="#concept-button" title="concept-button">button</a> but it is not <var title="">submitter</var>.</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 <a href="#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state and - whose <a href="#concept-fe-checked" title="concept-fe-checked">checkedness</a> is - 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 <a href="#radio-button-state" title="attr-input-type-radio">Radio Button</a> state and - whose <a href="#concept-fe-checked" title="concept-fe-checked">checkedness</a> is - false.</li> - - <li>The <var title="">field</var> element is not 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="#image-button-state" title="attr-input-type-image">Image Button</a> state, and - either the <var title="">field</var> element does not have a - <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute specified, or - its <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute's value is - the empty string.</li> - - <li>The <var title="">field</var> element is an - <code><a href="#the-object-element">object</a></code> element that is not using a - <a href="#plugin">plugin</a>.</li> - - </ul><p>Otherwise, process <var title="">field</var> as follows:</p> - - </li> - - <li><p>Let <var title="">type</var> be the value of the <code title="">type</code> IDL attribute of <var title="">field</var>.</li> <!-- if the field is an <object> - element, this will get ignored. --> - - <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 <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 a <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute specified and its - value is not the empty string, let <var title="">name</var> be - that value followed by a single U+002E FULL STOP character (.). - Otherwise, let <var title="">name</var> be the empty - string.</li> - - <li><p>Let <var title="">name<sub title="">x</sub></var> be the - string consisting of the concatenation of <var title="">name</var> and a single U+0078 LATIN SMALL LETTER X - character (x).</li> - - <li><p>Let <var title="">name<sub title="">y</sub></var> be the - string consisting of the concatenation of <var title="">name</var> and a single U+0079 LATIN SMALL LETTER Y - character (y).</li> - - <li><p>The <var title="">field</var> element is <var title="">submitter</var>, and before this algorithm was invoked - the user <a href="#concept-input-type-image-coordinate" title="concept-input-type-image-coordinate">indicated a - coordinate</a>. Let <var title="">x</var> be the <var title="">x</var>-component of the coordinate selected by the - user, and let <var title="">y</var> be the <var title="">y</var>-component of the coordinate selected by the - user.</li> - - <li><p>Append an entry to the <var title="">form data set</var> - with the name <var title="">name<sub title="">x</sub></var>, - the value <var title="">x</var>, and the type <var title="">type</var>.</li> - - <li><p>Append an entry to the <var title="">form data set</var> - with the name <var title="">name<sub title="">y</sub></var> and - the value <var title="">y</var>, and the type <var title="">type</var>.</li> - - <li><p>Skip the remaining substeps for this element: if there - are any more elements in <var title="">controls</var>, return - to the top of the <a href="#constructing-form-data-set">constructing the form data - set</a> step, otherwise, jump to the next step in the overall - form submission algorithm.</li> - - </ol></li> - - <li><p>Let <var title="">name</var> be the value of the <var title="">field</var> element's <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute.</li> - - <li><p>If the <var title="">field</var> element is a - <code><a href="#the-select-element">select</a></code> element, then for each <code><a href="#the-option-element">option</a></code> - element in the <code><a href="#the-select-element">select</a></code> element whose <a href="#concept-option-selectedness" title="concept-option-selectedness">selectedness</a> is true, - append an entry to the <var title="">form data set</var> with the - <var title="">name</var> as the name, the <a href="#concept-option-value" title="concept-option-value">value</a> of the - <code><a href="#the-option-element">option</a></code> element as the value, and <var title="">type</var> as the type.</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 <a href="#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state or the - <a href="#radio-button-state" title="attr-input-type-radio">Radio Button</a> state, - then run these further nested substeps:</p> - - <ol><li><p>If the <var title="">field</var> element has a <code title="attr-input-value"><a href="#attr-input-value">value</a></code> attribute specified, then - let <var title="">value</var> be the value of that attribute; - otherwise, let <var title="">value</var> be the string - "<code title="">on</code>".</li> - - <li><p>Append an entry to the <var title="">form data set</var> - with <var title="">name</var> as the name, <var title="">value</var> as the value, and <var title="">type</var> - as the type.</li> - - </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 <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 to the <var title="">form data set</var> with the <var title="">name</var> as - the name, the file (consisting of the name, the type, and the - body) as the value, and <var title="">type</var> as the type. If - there are no <a href="#concept-input-type-file-selected" title="concept-input-type-file-selected">selected files</a>, - then append an entry to the <var title="">form data set</var> - with the <var title="">name</var> as the name, the empty string - as the value, and <code>application/octet-stream</code> as the - type.</li> - <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=529859 --> - - <li><p>Otherwise, if the <var title="">field</var> element is an - <code><a href="#the-object-element">object</a></code> element: try to obtain a form submission - value from the <a href="#plugin">plugin</a><!-- using NPAPI's - NPP_GetValue() entry point with the NPPVformValue variable -->, - and if that is successful, append an entry to the <var title="">form data set</var> with <var title="">name</var> as the - name, the returned form submission value as the value, and the - string "<code title="">object</code>" as the type.</li> - - <li><p>Otherwise, append an entry to the <var title="">form data - set</var> with <var title="">name</var> as the name, the <a href="#concept-fe-value" title="concept-fe-value">value</a> of the <var title="">field</var> element as the value, and <var title="">type</var> as the type.</li> - - <li> - - <p>If the element has a <a href="#form-control-dirname-attribute">form control <code title="">dirname</code> attribute</a>, and that attribute's - value is not the empty string, then run these substeps:</p> - - <ol><li><p>Let <var title="">dirname</var> be the value of the - element's <code title="">dirname</code> attribute.</li> - - <li><p>Let <var title="">dir</var> be the string "<code title="">ltr</code>" if <a href="#the-directionality">the directionality</a> of the - element is '<a href="#concept-ltr" title="concept-ltr">ltr</a>', and "<code title="">rtl</code>" otherwise (i.e. when <a href="#the-directionality">the - directionality</a> of the element is '<a href="#concept-rtl" title="concept-rtl">rtl</a>').</li> - - <li><p>Append an entry to the <var title="">form data set</var> - with <var title="">dirname</var> as the name, <var title="">dir</var> as the value, and the string "<code title="">direction</code>" as the type.</li> - - </ol><p class="note">An element can only have a <a href="#form-control-dirname-attribute">form control - <code title="">dirname</code> attribute</a> if it is a - <code><a href="#the-textarea-element">textarea</a></code> element or 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 - either the <a href="#text-state-and-search-state" title="attr-input-type-text">Text</a> state - or the <a href="#text-state-and-search-state" title="attr-input-type-search">Search</a> - state.</p> - - </li> - - </ol></li> + <li><p>Let <var title="">form data set</var> be the result of + <a href="#constructing-the-form-data-set">constructing the form data set</a> for <var title="">form</var>.</li> <li><p>Let <var title="">action</var> be the <var title="">submitter</var> element's <a href="#concept-fs-action" title="concept-fs-action">action</a>.</li> @@ -38848,9 +38679,186 @@ </dl></li> - </ol></div><div class="impl"> + </ol><h5 id="constructing-form-data-set"><span class="secno">4.10.22.4 </span>Constructing the form data set</h5> - <h5 id="url-encoded-form-data"><span class="secno">4.10.22.4 </span>URL-encoded form data</h5> + <p>The algorithm to <dfn id="constructing-the-form-data-set" title="constructing the form data + set">construct the form data set</dfn> for a form <var title="">form</var> is as follows:</p> + + <ol><li><p>Let <var title="">controls</var> be a list of all the <a href="#category-submit" title="category-submit">submittable elements</a> whose + <a href="#form-owner">form owner</a> is <var title="">form</var>, in <a href="#tree-order">tree + order</a>.</li> + + <li><p>Let the <var title="">form data set</var> be a list of + name-value-type tuples, initially empty.</li> + + <li> + + <p><i>Loop</i>: For each element <var title="">field</var> in <var title="">controls</var>, in <a href="#tree-order">tree order</a>, run the + following substeps:</p> + + <ol><li> + + <p>If any of the following conditions are met, then skip these + substeps for this element:</p> + + <ul><li>The <var title="">field</var> element has a + <code><a href="#the-datalist-element">datalist</a></code> element ancestor.</li> + + <li>The <var title="">field</var> element is <a href="#concept-fe-disabled" title="concept-fe-disabled">disabled</a>.</li> + + <li>The <var title="">field</var> element is a <a href="#concept-button" title="concept-button">button</a> but it is not <var title="">submitter</var>.</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 <a href="#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state and + whose <a href="#concept-fe-checked" title="concept-fe-checked">checkedness</a> is + 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 <a href="#radio-button-state" title="attr-input-type-radio">Radio Button</a> state and + whose <a href="#concept-fe-checked" title="concept-fe-checked">checkedness</a> is + false.</li> + + <li>The <var title="">field</var> element is not 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="#image-button-state" title="attr-input-type-image">Image Button</a> state, and + either the <var title="">field</var> element does not have a + <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute specified, or + its <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute's value is + the empty string.</li> + + <li>The <var title="">field</var> element is an + <code><a href="#the-object-element">object</a></code> element that is not using a + <a href="#plugin">plugin</a>.</li> + + </ul><p>Otherwise, process <var title="">field</var> as follows:</p> + + </li> + + <li><p>Let <var title="">type</var> be the value of the <code title="">type</code> IDL attribute of <var title="">field</var>.</li> <!-- if the field is an <object> + element, this will get ignored. --> + + <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 <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 a <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute specified and its + value is not the empty string, let <var title="">name</var> be + that value followed by a single U+002E FULL STOP character (.). + Otherwise, let <var title="">name</var> be the empty + string.</li> + + <li><p>Let <var title="">name<sub title="">x</sub></var> be the + string consisting of the concatenation of <var title="">name</var> and a single U+0078 LATIN SMALL LETTER X + character (x).</li> + + <li><p>Let <var title="">name<sub title="">y</sub></var> be the + string consisting of the concatenation of <var title="">name</var> and a single U+0079 LATIN SMALL LETTER Y + character (y).</li> + + <li><p>The <var title="">field</var> element is <var title="">submitter</var>, and before this algorithm was invoked + the user <a href="#concept-input-type-image-coordinate" title="concept-input-type-image-coordinate">indicated a + coordinate</a>. Let <var title="">x</var> be the <var title="">x</var>-component of the coordinate selected by the + user, and let <var title="">y</var> be the <var title="">y</var>-component of the coordinate selected by the + user.</li> + + <li><p>Append an entry to the <var title="">form data set</var> + with the name <var title="">name<sub title="">x</sub></var>, + the value <var title="">x</var>, and the type <var title="">type</var>.</li> + + <li><p>Append an entry to the <var title="">form data set</var> + with the name <var title="">name<sub title="">y</sub></var> and + the value <var title="">y</var>, and the type <var title="">type</var>.</li> + + <li><p>Skip the remaining substeps for this element: if there + are any more elements in <var title="">controls</var>, return + to the top of the <i>loop</i> step, otherwise, jump to the + <i>end</i> step below.</li> + + </ol></li> + + <li><p>Let <var title="">name</var> be the value of the <var title="">field</var> element's <code title="attr-fe-name"><a href="#attr-fe-name">name</a></code> attribute.</li> + + <li><p>If the <var title="">field</var> element is a + <code><a href="#the-select-element">select</a></code> element, then for each <code><a href="#the-option-element">option</a></code> + element in the <code><a href="#the-select-element">select</a></code> element whose <a href="#concept-option-selectedness" title="concept-option-selectedness">selectedness</a> is true, + append an entry to the <var title="">form data set</var> with the + <var title="">name</var> as the name, the <a href="#concept-option-value" title="concept-option-value">value</a> of the + <code><a href="#the-option-element">option</a></code> element as the value, and <var title="">type</var> as the type.</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 <a href="#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state or the + <a href="#radio-button-state" title="attr-input-type-radio">Radio Button</a> state, + then run these further nested substeps:</p> + + <ol><li><p>If the <var title="">field</var> element has a <code title="attr-input-value"><a href="#attr-input-value">value</a></code> attribute specified, then + let <var title="">value</var> be the value of that attribute; + otherwise, let <var title="">value</var> be the string + "<code title="">on</code>".</li> + + <li><p>Append an entry to the <var title="">form data set</var> + with <var title="">name</var> as the name, <var title="">value</var> as the value, and <var title="">type</var> + as the type.</li> + + </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 <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 to the <var title="">form data set</var> with the <var title="">name</var> as + the name, the file (consisting of the name, the type, and the + body) as the value, and <var title="">type</var> as the type. If + there are no <a href="#concept-input-type-file-selected" title="concept-input-type-file-selected">selected files</a>, + then append an entry to the <var title="">form data set</var> + with the <var title="">name</var> as the name, the empty string + as the value, and <code>application/octet-stream</code> as the + type.</li> + <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=529859 --> + + <li><p>Otherwise, if the <var title="">field</var> element is an + <code><a href="#the-object-element">object</a></code> element: try to obtain a form submission + value from the <a href="#plugin">plugin</a><!-- using NPAPI's + NPP_GetValue() entry point with the NPPVformValue variable -->, + and if that is successful, append an entry to the <var title="">form data set</var> with <var title="">name</var> as the + name, the returned form submission value as the value, and the + string "<code title="">object</code>" as the type.</li> + + <li><p>Otherwise, append an entry to the <var title="">form data + set</var> with <var title="">name</var> as the name, the <a href="#concept-fe-value" title="concept-fe-value">value</a> of the <var title="">field</var> element as the value, and <var title="">type</var> as the type.</li> + + <li> + + <p>If the element has a <a href="#form-control-dirname-attribute">form control <code title="">dirname</code> attribute</a>, and that attribute's + value is not the empty string, then run these substeps:</p> + + <ol><li><p>Let <var title="">dirname</var> be the value of the + element's <code title="">dirname</code> attribute.</li> + + <li><p>Let <var title="">dir</var> be the string "<code title="">ltr</code>" if <a href="#the-directionality">the directionality</a> of the + element is '<a href="#concept-ltr" title="concept-ltr">ltr</a>', and "<code title="">rtl</code>" otherwise (i.e. when <a href="#the-directionality">the + directionality</a> of the element is '<a href="#concept-rtl" title="concept-rtl">rtl</a>').</li> + + <li><p>Append an entry to the <var title="">form data set</var> + with <var title="">dirname</var> as the name, <var title="">dir</var> as the value, and the string "<code title="">direction</code>" as the type.</li> + + </ol><p class="note">An element can only have a <a href="#form-control-dirname-attribute">form control + <code title="">dirname</code> attribute</a> if it is a + <code><a href="#the-textarea-element">textarea</a></code> element or 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 + either the <a href="#text-state-and-search-state" title="attr-input-type-text">Text</a> state + or the <a href="#text-state-and-search-state" title="attr-input-type-search">Search</a> + state.</p> + + </li> + + </ol></li> + + <li><p><i>End</i>: Return the <var title="">form data + step</var>.</li> + + </ol><h5 id="url-encoded-form-data"><span class="secno">4.10.22.5 </span>URL-encoded form data</h5> <p>The <dfn id="application-x-www-form-urlencoded-encoding-algorithm"><code title="">application/x-www-form-urlencoded</code> encoding algorithm</dfn> is as follows:</p> @@ -38981,7 +38989,7 @@ </ol></div><div class="impl"> - <h5 id="multipart-form-data"><span class="secno">4.10.22.5 </span>Multipart form data</h5> + <h5 id="multipart-form-data"><span class="secno">4.10.22.6 </span>Multipart form data</h5> <!-- http://hixie.ch/tests/adhoc/html/forms/submission/multipart_form-data/ --> @@ -39071,7 +39079,7 @@ </ol></div><div class="impl"> - <h5 id="plain-text-form-data"><span class="secno">4.10.22.6 </span>Plain text form data</h5> + <h5 id="plain-text-form-data"><span class="secno">4.10.22.7 </span>Plain text form data</h5> <p>The <dfn id="text-plain-encoding-algorithm"><code title="">text/plain</code> encoding algorithm</dfn> is as follows:</p>
Received on Friday, 4 March 2011 01:15:58 UTC