Skip to content

Commit e0742f8

Browse files
authored
Add form.requestSubmit()
Closes #4187. Tests: web-platform-tests/wpt#16743.
1 parent 1d112e1 commit e0742f8

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

source

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43117,6 +43117,7 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
4311743117
<a href="#dom-form-nameditem">getter</a> (<span>RadioNodeList</span> or <span>Element</span>) (DOMString name);
4311843118

4311943119
void <span data-x="dom-form-submit">submit</span>();
43120+
void <span data-x="dom-form-requestSubmit">requestSubmit</span>(optional <span>HTMLElement</span> submitter);
4312043121
[<span>CEReactions</span>] void <span data-x="dom-form-reset">reset</span>();
4312143122
boolean <span data-x="dom-form-checkValidity">checkValidity</span>();
4312243123
boolean <span data-x="dom-form-reportValidity">reportValidity</span>();
@@ -43228,7 +43229,30 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
4322843229

4322943230
<dd>
4323043231

43231-
<p>Submits the form.</p>
43232+
<p>Submits the form, bypassing <span data-x="interactively validate the constraints">interactive
43233+
constraint validation</span> and without firing a <code data-x="event-submit">submit</code>
43234+
event.</p>
43235+
43236+
</dd>
43237+
43238+
<dt><var>form</var> . <code subdfn data-x="dom-form-requestSubmit">requestSubmit</code>( [ <var>submitter</var> ] )</dt>
43239+
43240+
<dd>
43241+
43242+
<p>Requests to submit the form. Unlike <code data-x="dom-form-submit">submit()</code>, this
43243+
method includes <span data-x="interactively validate the constraints">interactive constraint
43244+
validation</span> and firing a <code data-x="event-submit">submit</code> event, either of which
43245+
can cancel submission.</p>
43246+
43247+
<p>The <var>submitter</var> argument can be used to point to a specific <span
43248+
data-x="concept-submit-button">submit button</span>, whose <code
43249+
data-x="attr-fs-formaction">formaction</code>, <code
43250+
data-x="attr-fs-formenctype">formenctype</code>, <code
43251+
data-x="attr-fs-formmethod">formmethod</code>, <code
43252+
data-x="attr-fs-formnovalidate">formnovalidate</code>, and <code
43253+
data-x="attr-fs-formtarget">formtarget</code> attributes can impact submission. Additionally,
43254+
the submitter will be included when <span>constructing the entry list</span> for submission;
43255+
normally, buttons are excluded.</p>
4323243256

4323343257
</dd>
4323443258

@@ -43458,6 +43482,28 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
4345843482
element itself, with the <var>submitted from <code
4345943483
data-x="dom-form-submit">submit()</code> method</var> flag set.</p>
4346043484

43485+
<p>The <dfn><code data-x="dom-form-requestSubmit">requestSubmit(<var>submitter</var>)</code></dfn>
43486+
method, when invoked, must run the following steps:</p>
43487+
43488+
<ol>
43489+
<li>
43490+
<p>If <var>submitter</var> was given, then:</p>
43491+
43492+
<ol>
43493+
<li><p>If <var>submitter</var> is not a <span data-x="concept-submit-button">submit
43494+
button</span>, then throw a <code>TypeError</code>.</p></li>
43495+
43496+
<li><p>If <var>submitter</var>'s <span>form owner</span> is not this <code>form</code> element,
43497+
then throw a <span>"<code>NotFoundError</code>"</span> <code>DOMException</code>.</p></li>
43498+
</ol>
43499+
</li>
43500+
43501+
<li><p>Otherwise, set <var>submitter</var> to this <code>form</code> element.</p></li>
43502+
43503+
<li><p><span data-x="concept-form-submit">Submit</span> this <code>form</code> element, from
43504+
<var>submitter</var>.</p></li>
43505+
</ol>
43506+
4346143507
<p>The <dfn><code data-x="dom-form-reset">reset()</code></dfn> method, when invoked, must run the
4346243508
following steps:</p>
4346343509

@@ -123125,6 +123171,7 @@ INSERT INTERFACES HERE
123125123171
Malcolm Rowe,
123126123172
Manish Goregaokar,
123127123173
Manish Tripathi,
123174+
Manuel Martinez-Almeida,
123128123175
Marc Hoyois,
123129123176
Marc-André Choquette, <!-- eel-in-a-hovercraft on GitHub -->
123130123177
Marc-André Lafortune,
@@ -123214,6 +123261,7 @@ INSERT INTERFACES HERE
123214123261
Mounir Lamouri,
123215123262
Ms2ger,
123216123263
mtrootyy,
123264+
邱慕安 (Mu-An<!--grammar-check-override--> Chiou),
123217123265
Mukilan Thiyagarajan,
123218123266
Mustaq Ahmed,
123219123267
Nadia Heninger,

0 commit comments

Comments
 (0)