Skip to content

Commit

Permalink
Add optional submitter argument to FormData constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jenseng committed Jan 27, 2023
1 parent 494431a commit 1c2d7f2
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions xhr.bs
Expand Up @@ -9,6 +9,11 @@ Translation: ja https://triple-underscore.github.io/XHR-ja.html
Translate IDs: enumdef-xmlhttprequestresponsetype xmlhttprequestresponsetype,dictdef-progresseventinit progresseventinit,typedefdef-formdataentryvalue formdataentryvalue
</pre>

<!-- Temporary: https://github.com/w3c/webdriver-bidi/issues/358 -->
<pre class=link-defaults>
spec:webdriver-bidi; type:dfn; text:event
</pre>

<pre class=anchors>
urlPrefix: https://w3c.github.io/DOM-Parsing/; spec: dom-parsing
type: dfn; text: fragment serializing algorithm; url: dfn-fragment-serializing-algorithm
Expand Down Expand Up @@ -1609,7 +1614,7 @@ typedef (File or USVString) FormDataEntryValue;

[Exposed=(Window,Worker)]
interface FormData {
constructor(optional HTMLFormElement form);
constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null);

undefined append(USVString name, USVString value);
undefined append(USVString name, Blob blobValue, optional USVString filename);
Expand All @@ -1635,16 +1640,27 @@ interface FormData {
moved to the HTML Standard. [[HTML]]

<p>The
<dfn id=dom-formdata constructor for=FormData lt="FormData(form)"><code>new FormData(<var>form</var>)</code></dfn>
<dfn id=dom-formdata constructor for=FormData lt="FormData(form)"><code>new FormData(<var>form</var>, <var>submitter</var>)</code></dfn>
constructor steps are:

<ol>
<li>
<p>If <var>form</var> is given, then:

<ol>
<li>
<p>If <var>submitter</var> is non-null, then:

<ol>
<li><p>If <var>submitter</var> is not a <a>submit button</a>, then <a>throw</a> a
{{TypeError}}.

<li><p>If <var>submitter</var>'s <a>form owner</a> is not <var>form</var>, then <a>throw</a> a
"{{NotFoundError!!exception}}" {{DOMException}}.
</ol>

<li><p>Let <var>list</var> be the result of <a>constructing the entry list</a> for
<var>form</var>.
<var>form</var> and <var>submitter</var>.

<li><p>If <var>list</var> is null, then <a>throw</a> an "{{InvalidStateError!!exception}}"
{{DOMException}}.
Expand Down

0 comments on commit 1c2d7f2

Please sign in to comment.