Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event-based form participation #4239

Merged
merged 4 commits into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3410,6 +3410,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="dom-ProgressEvent-loaded" data-x-href="https://xhr.spec.whatwg.org/#dom-progressevent-loaded"><code>ProgressEvent.loaded</code></dfn> attribute</li>
<li><dfn data-x="dom-ProgressEvent-total" data-x-href="https://xhr.spec.whatwg.org/#dom-progressevent-total"><code>ProgressEvent.total</code></dfn> attribute</li>
<li><dfn data-x="fire a progress event" data-x-href="https://xhr.spec.whatwg.org/#concept-event-fire-progress">Fire a progress event named <var>e</var></dfn></li>
<li><dfn data-x-href="https://xhr.spec.whatwg.org/#formdata"><code>FormData</code></dfn>
interface</li>
<li>The concept of <dfn data-x="formdata-entry" data-x-href="https://xhr.spec.whatwg.org/#concept-formdata-entry">entry</dfn></li>
<li><dfn data-x-href="https://xhr.spec.whatwg.org/#create-an-entry">create an entry</dfn></li>
</ul>
Expand Down Expand Up @@ -55784,6 +55786,9 @@ fur

<h5>Form submission algorithm</h5>

<p>Each <code>form</code> element has a <dfn>constructing entry list</dfn> boolean, initially
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
false.</p>

<p>When a <code>form</code> element <var>form</var> is <dfn
data-x="concept-form-submit">submitted</dfn> from an element <var>submitter</var>
(typically a button), optionally with a <var>submitted from <code
Expand All @@ -55793,6 +55798,8 @@ fur
<ol>
<li><p>If <var>form</var> <span>cannot navigate</span>, then return.</p></li>

<li><p>If <var>form</var>'s <span>constructing entry list</span> is true, then return.</p></li>
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Let <var>form document</var> be <var>form</var>'s <span>node document</span>.</p></li>

<li id="sandboxSubmitBlocked"><p>If <var>form document</var>'s <span>active sandboxing flag
Expand Down Expand Up @@ -55842,6 +55849,14 @@ fur
<li><p>Let <var>entry list</var> be the result of <span>constructing the entry list</span> with
<var>form</var>, <var>submitter</var>, and <var>encoding</var>.</p></li>

<li>
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
<p>If <var>form</var> <span>cannot navigate</span>, then return.</p>

<p class="note"><span>Cannot navigate</span> is run again as dispatching the <code
data-x="event-formdata">formdata</code> event in <span>constructing the entry list</span>
could have changed the outcome.</p>
</li>

<li><p>Let <var>action</var> be the <var>submitter</var> element's <span
data-x="concept-fs-action">action</span>.</p></li>

Expand Down Expand Up @@ -56156,6 +56171,11 @@ fur
follows. If not specified otherwise, <var>submitter</var> is null.</p>

<ol>
<li><p>If <var>form</var>'s <span>constructing entry list</span> is true, then return
null.</p></li>

<li><p>Set <var>form</var>'s <span>constructing entry list</span> to true.</p></li>

<li><p>Let <var>controls</var> be a list of all the <span
data-x="category-submit">submittable elements</span> whose <span>form owner</span> is <var>form</var>, in <span>tree order</span>.</p></li>

Expand Down Expand Up @@ -56345,6 +56365,16 @@ fur
</ol>
</li>

<li><p>Let <var>form data</var> be a new <code>FormData</code> object associated with
<var>entry list</var>.</p></li>

<li><p><span data-x="concept-event-fire">Fire an event</span> named
<code data-x="event-formdata">formdata</code> at <var>form</var> using
<code>FormDataEvent</code>, with the <code data-x="dom-FormDataEvent-formData">formData</code>
attribute initialized to <var>form data</var>.</p></li>

<li><p>Set <var>form</var>'s <span>constructing entry list</span> to false.</p></li>

<li><p>Return <var>entry list</var>.</p></li>
</ol>

Expand Down Expand Up @@ -56542,10 +56572,38 @@ fur
not reliably interpretable by computer, as the format is ambiguous (for example, there is no way
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
to distinguish a literal newline in a value from the newline at the end of the value).</p>

<h5>The <code>FormDataEvent</code> interface</h5>

<pre><code class="idl" data-x="">[Exposed=Window,
Constructor(DOMString type, optional FormDataEventInit eventInitDict)]
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
interface <dfn>FormDataEvent</dfn> : <span>Event</span> {
readonly attribute <span>FormData</span> <span data-x="dom-FormDataEvent-formData">formData</span>;
};

dictionary <dfn>FormDataEventInit</dfn> : <span>EventInit</span> {
required <span>FormData</span> formData;
};</code></pre>

<dl class="domintro">

<dt><var>event</var> . <code data-x="dom-FormDataEvent-formData">formData</code></dt>

<dd>

<p>Returns a <code>FormData</code> object representing names and values of elements associated
to the target <code>form</code>. Operations on the <code>FormData</code> object will affect
form data to be submitted.</p>

</dd>

</dl>

<div w-nodev>

<p>The <dfn><code data-x="dom-FormDataEvent-formData">formData</code></dfn> attribute must return the value it was
initialized to. It represents a <code>FormData</code> object associated to the entry list that is <span
data-x="constructing the entry list">constructed</span> when the <code>form</code> is submitted.</p>

<h4>Resetting a form</h4>

<p>When a <code>form</code> element <var>form</var> is <dfn
Expand Down Expand Up @@ -90779,6 +90837,7 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn>OnBeforeUnloadEvent
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-ondurationchange">ondurationchange</code></dfn> <td> <code data-x="event-media-durationchange">durationchange</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-onemptied">onemptied</code></dfn> <td> <code data-x="event-media-emptied">emptied</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-onended">onended</code></dfn> <td> <code data-x="event-media-ended">ended</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-onformdata">onformdata</code></dfn> <td> <code data-x="event-formdata">formdata</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-oninput">oninput</code></dfn> <td> <code data-x="event-input">input</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-oninvalid">oninvalid</code></dfn> <td> <code data-x="event-invalid">invalid</code>
<tr><td><dfn data-export="" data-dfn-type="attribute" data-dfn-for="HTMLElement,Document,Window,GlobalEventHandlers"><code data-x="handler-onkeydown">onkeydown</code></dfn> <td> <code data-x="event-keydown">keydown</code> <!-- widely used -->
Expand Down Expand Up @@ -90959,6 +91018,7 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn>OnBeforeUnloadEvent
attribute <span>EventHandler</span> <span data-x="handler-onended">onended</span>;
attribute <span>OnErrorEventHandler</span> <span data-x="handler-onerror">onerror</span>;
attribute <span>EventHandler</span> <span data-x="handler-onfocus">onfocus</span>;
attribute <span>EventHandler</span> <span data-x="handler-onformdata">onformdata</span>;
attribute <span>EventHandler</span> <span data-x="handler-oninput">oninput</span>;
attribute <span>EventHandler</span> <span data-x="handler-oninvalid">oninvalid</span>;
attribute <span>EventHandler</span> <span data-x="handler-onkeydown">onkeydown</span>;
Expand Down Expand Up @@ -119917,6 +119977,12 @@ interface <dfn>External</dfn> {
<td> <code data-x="event-focus">focus</code> event handler
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-onformdata"> <code data-x="">onformdata</code>
<td> <span data-x="handler-onformdata">HTML elements</span>
<td> <code data-x="event-formdata">formdata</code> event handler
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-window-onhashchange"> <code data-x="">onhashchange</code>
<td> <code data-x="handler-window-onhashchange">body</code>
Expand Down Expand Up @@ -120810,6 +120876,12 @@ INSERT INTERFACES HERE
<td> <code>Window</code>, elements
<td> Fired at nodes <span data-x="gains focus">gaining focus</span>

<tr> <!-- formdata -->
<td> <dfn data-dfn-type="event" data-dfn-for="HTMLElement" data-export=""><code data-x="event-formdata">formdata</code></dfn>
<td> <code>FormDataEvent</code>
<td> <code>form</code> elements
<td> Fired at a <code>form</code> element when it is <span>constructing the entry list</span>

<tr> <!-- hashchange -->
<td> <dfn data-dfn-type="event" data-dfn-for="Window" data-export=""><code data-x="event-hashchange">hashchange</code></dfn>
<td> <code>HashChangeEvent</code>
Expand Down