Skip to content
Permalink
Browse files

[giow] (3) Make <form> submission more like reality.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=20580
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7992 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Jun 19, 2013
1 parent 63aaf58 commit ea2970268d5ec1659c36f6504b89a9f84c382af5
Showing with 145 additions and 59 deletions.
  1. +45 −18 complete.html
  2. +45 −18 index
  3. +55 −23 source
defining this, act in a manner analogous to that defined in this specification for similar
schemes.</p>

<p>The behaviors are as follows:</p>
<p>Each <code><a href=#the-form-element>form</a></code> element has a <dfn id=planned-navigation>planned navigation</dfn>, which is either null or a
<a href=#concept-task title=concept-task>task</a>; when the <code><a href=#the-form-element>form</a></code> is first created, its
<a href=#planned-navigation>planned navigation</a> must be set to null. In the behaviours described below, when the
user agent is required to <dfn id=plan-to-navigate>plan to navigate</dfn> to a particular resource <var title="">destination</var>, it must run the following steps:</p>

<ol><li><p>If the <code><a href=#the-form-element>form</a></code> has a non-null <a href=#planned-navigation>planned navigation</a>, remove it from
its <a href=#task-queue>task queue</a>.</li>

<li>

<p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be a new <a href=#concept-task title=concept-task>task</a> that consists of running the following steps:</p>

<ol><li><p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be null.</li>

<li><p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to
the particular resource <var title="">destination</var>. If <var title="">replace</var> is
true, then <var title="">target browsing context</var> must be navigated with
<a href=#replacement-enabled>replacement enabled</a>.</p>

</ol><p>For the purposes of this task, <var title="">target browsing context</var> and <var title="">replace</var> are the variables that were set up when the overall form submission
algorithm was run, with their values as they stood when this <a href=#planned-navigation>planned navigation</a>
was <a href=#queue-a-task title="queue a task">queued</a>.</p>

</li>

<li>

<p><a href=#queue-a-task title="queue a task">Queue the task</a> that is the <code><a href=#the-form-element>form</a></code>'s new
<a href=#planned-navigation>planned navigation</a>.</p>

<p>The <a href=#task-source>task source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
source</a>.</p>

</li>

</ol><p>The behaviors are as follows:</p>

<dl><dt><dfn id=submit-mutate-action title=submit-mutate-action>Mutate action URL</dfn>
<dd>
<p>Let <var title="">destination</var> be a new <a href=#url>URL</a> formed by applying the
<a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> algorithm to <var title="">parsed action</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>

</dl><!--<p>If <var title="">method</var> is anything but (GET or) POST, and the
<span>origin</span> of <var title="">action</var> is not the <span>same origin</span> as that
of <var title="">form document</var>, then abort these steps.</p> [or do CORS] (this is
commented out since only POST can trigger this now, and that's historically unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing
context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var> as the entity body, of type
<var title="">MIME type</var>. If <var title="">replace</var> is true, then <var title="">target browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
enabled</a>.</p>
commented out since only POST can trigger this now, and that's historically unrestricted)--><p>Otherwise, <a href=#plan-to-navigate>plan to navigate</a> to <var title="">action</var> using the HTTP
method given by <var title="">method</var> and with <var title="">entity body</var> as the
entity body, of type <var title="">MIME type</var>.</p>

</dd>

<dt><dfn id=submit-get-action title=submit-get-action>Get action URL</dfn>
<dd>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">action</var>.</p>

<p class=note>The <var title="">form data set</var> is discarded.</p>

not characters in the URL <a href=#default-encode-set>default encode set</a>, and then, treating the result as a
US-ASCII string, replace the first occurrence of "<code title="">%%</code>" in <var title="">action</var> with the resulting escaped string. <a href=#refsURL>[URL]</a></p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to the
potentially modified <var title="">action</var> (which will be a <a href=#data-protocol title="data
protocol"><code title="">data:</code> URL</a>). If <var title="">replace</var> is true,
then <var title="">target browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to the potentially modified <var title="">action</var> (which
will be a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>).</p>

</dd>


<p>Append <var title="">headers</var> to <var title="">destination</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>


<p>Append <var title="">body</var>, interpreted as a US-ASCII string, to <var title="">destination</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>

63 index
defining this, act in a manner analogous to that defined in this specification for similar
schemes.</p>

<p>The behaviors are as follows:</p>
<p>Each <code><a href=#the-form-element>form</a></code> element has a <dfn id=planned-navigation>planned navigation</dfn>, which is either null or a
<a href=#concept-task title=concept-task>task</a>; when the <code><a href=#the-form-element>form</a></code> is first created, its
<a href=#planned-navigation>planned navigation</a> must be set to null. In the behaviours described below, when the
user agent is required to <dfn id=plan-to-navigate>plan to navigate</dfn> to a particular resource <var title="">destination</var>, it must run the following steps:</p>

<ol><li><p>If the <code><a href=#the-form-element>form</a></code> has a non-null <a href=#planned-navigation>planned navigation</a>, remove it from
its <a href=#task-queue>task queue</a>.</li>

<li>

<p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be a new <a href=#concept-task title=concept-task>task</a> that consists of running the following steps:</p>

<ol><li><p>Let the <code><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation>planned navigation</a> be null.</li>

<li><p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to
the particular resource <var title="">destination</var>. If <var title="">replace</var> is
true, then <var title="">target browsing context</var> must be navigated with
<a href=#replacement-enabled>replacement enabled</a>.</p>

</ol><p>For the purposes of this task, <var title="">target browsing context</var> and <var title="">replace</var> are the variables that were set up when the overall form submission
algorithm was run, with their values as they stood when this <a href=#planned-navigation>planned navigation</a>
was <a href=#queue-a-task title="queue a task">queued</a>.</p>

</li>

<li>

<p><a href=#queue-a-task title="queue a task">Queue the task</a> that is the <code><a href=#the-form-element>form</a></code>'s new
<a href=#planned-navigation>planned navigation</a>.</p>

<p>The <a href=#task-source>task source</a> for this task is the <a href=#dom-manipulation-task-source>DOM manipulation task
source</a>.</p>

</li>

</ol><p>The behaviors are as follows:</p>

<dl><dt><dfn id=submit-mutate-action title=submit-mutate-action>Mutate action URL</dfn>
<dd>
<p>Let <var title="">destination</var> be a new <a href=#url>URL</a> formed by applying the
<a href=#concept-url-serializer title=concept-url-serializer>URL serializer</a> algorithm to <var title="">parsed action</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>

</dl><!--<p>If <var title="">method</var> is anything but (GET or) POST, and the
<span>origin</span> of <var title="">action</var> is not the <span>same origin</span> as that
of <var title="">form document</var>, then abort these steps.</p> [or do CORS] (this is
commented out since only POST can trigger this now, and that's historically unrestricted)--><p>Otherwise, <a href=#navigate>navigate</a><!--DONAV form--> <var title="">target browsing
context</var> to <var title="">action</var> using the HTTP method given by <var title="">method</var> and with <var title="">entity body</var> as the entity body, of type
<var title="">MIME type</var>. If <var title="">replace</var> is true, then <var title="">target browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
enabled</a>.</p>
commented out since only POST can trigger this now, and that's historically unrestricted)--><p>Otherwise, <a href=#plan-to-navigate>plan to navigate</a> to <var title="">action</var> using the HTTP
method given by <var title="">method</var> and with <var title="">entity body</var> as the
entity body, of type <var title="">MIME type</var>.</p>

</dd>

<dt><dfn id=submit-get-action title=submit-get-action>Get action URL</dfn>
<dd>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">action</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">action</var>.</p>

<p class=note>The <var title="">form data set</var> is discarded.</p>

not characters in the URL <a href=#default-encode-set>default encode set</a>, and then, treating the result as a
US-ASCII string, replace the first occurrence of "<code title="">%%</code>" in <var title="">action</var> with the resulting escaped string. <a href=#refsURL>[URL]</a></p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to the
potentially modified <var title="">action</var> (which will be a <a href=#data-protocol title="data
protocol"><code title="">data:</code> URL</a>). If <var title="">replace</var> is true,
then <var title="">target browsing context</var> must be navigated with <a href=#replacement-enabled>replacement
enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to the potentially modified <var title="">action</var> (which
will be a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>).</p>

</dd>


<p>Append <var title="">headers</var> to <var title="">destination</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>


<p>Append <var title="">body</var>, interpreted as a US-ASCII string, to <var title="">destination</var>.</p>

<p><a href=#navigate>Navigate</a><!--DONAV form--> <var title="">target browsing context</var> to <var title="">destination</var>. If <var title="">replace</var> is true, then <var title="">target
browsing context</var> must be navigated with <a href=#replacement-enabled>replacement enabled</a>.</p>
<p><a href=#plan-to-navigate>Plan to navigate</a> to <var title="">destination</var>.</p>

</dd>

0 comments on commit ea29702

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