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

Forms: Introduce SubmitEvent for 'submit' event #4984

Merged
merged 7 commits into from
Oct 31, 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
40 changes: 36 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -43232,7 +43232,7 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
<a href="#dom-form-nameditem">getter</a> (<span>RadioNodeList</span> or <span>Element</span>) (DOMString name);

void <span data-x="dom-form-submit">submit</span>();
void <span data-x="dom-form-requestSubmit">requestSubmit</span>(optional <span>HTMLElement</span> submitter);
void <span data-x="dom-form-requestSubmit">requestSubmit</span>(optional <span>HTMLElement</span>? submitter = null);
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
[<span>CEReactions</span>] void <span data-x="dom-form-reset">reset</span>();
boolean <span data-x="dom-form-checkValidity">checkValidity</span>();
boolean <span data-x="dom-form-reportValidity">reportValidity</span>();
Expand Down Expand Up @@ -43602,7 +43602,7 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {

<ol>
<li>
<p>If <var>submitter</var> was given, then:</p>
<p>If <var>submitter</var> is not null, then:</p>

<ol>
<li><p>If <var>submitter</var> is not a <span data-x="concept-submit-button">submit
Expand Down Expand Up @@ -56326,9 +56326,14 @@ fur
</ol>
</li>

<li><p>Let <var>submitterButton</var> be null if <var>submitter</var> is <var>form</var>.
Otherwise, let <var>submitterButton</var> be <var>submitter</var>.</p></li>

<li><p>Let <var>continue</var> be the result of <span data-x="concept-event-fire">firing an
event</span> named <code data-x="event-submit">submit</code> at <var>form</var>, with the <code
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true and the <code
event</span> named <code data-x="event-submit">submit</code> at <var>form</var> using
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
<code>SubmitEvent</code>, with the <code data-x="dom-SubmitEvent-submitter">submitter</code>
attribute initialized to <var>submitterButton</var>, the <code
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true, and the <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>

<li><p>Set <var>form</var>'s <span>firing submission events</span> to false.</p></li>
Expand Down Expand Up @@ -57088,6 +57093,33 @@ fur
not reliably interpretable by computer, as the format is ambiguous (for example, there is no way
to distinguish a literal newline in a value from the newline at the end of the value).</p>

<h5>The <code>SubmitEvent</code> interface</h5>
tkent-google marked this conversation as resolved.
Show resolved Hide resolved

<pre><code class="idl" data-x="">[Exposed=Window]
interface <dfn>SubmitEvent</dfn> : <span>Event</span> {
constructor(DOMString type, optional <span>SubmitEventInit</span> eventInitDict = {});

readonly attribute <span>HTMLElement</span>? <span data-x="dom-SubmitEvent-submitter">submitter</span>;
};

dictionary <dfn>SubmitEventInit</dfn> : <span>EventInit</span> {
<span>HTMLElement</span>? submitter = null;
tkent-google marked this conversation as resolved.
Show resolved Hide resolved
};</code></pre>

<dl class="domintro">
<dt><var>event</var> . <code data-x="dom-SubmitEvent-submitter">submitter</code></dt>
<dd><p>Returns the element representing the <span data-x="concept-submit-button">submit
button</span> that triggered the <span>form submission</span>, or null if the submission was
not triggered by a button.</p></dd>
</dl>

<div w-nodev>

<p>The <dfn><code data-x="dom-SubmitEvent-submitter">submitter</code></dfn> attribute must return
the value it was initialized to.</p>

</div>

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

<pre><code class="idl" data-x="">[Exposed=Window,
Expand Down