Skip to content

Commit 50a0414

Browse files
committed
Add PUT, PATCH, and DELETE to form method attribute
Resolves: whatwg#3577 This adds `put`, `patch`, and `delete` values to the form element's `method` attribute, and alters navigation to properly handle those additional HTTP methods. It relies on a corresponding change to fetch spec, which allows `mode=navigate` fetches to make CORS requests ([fetch spec PR whatwg#1785](whatwg/fetch#1785)).
1 parent 9b957e8 commit 50a0414

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

source

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
25342534
<p>The following terms are defined in the HTTP specifications: <ref>HTTP</ref></p>
25352535

25362536
<ul class="brief">
2537+
<li><dfn data-x="http-method" data-x-href="https://httpwg.org/specs/rfc7231.html#methods">method</dfn></li>
2538+
<li><dfn data-x="http-idempotent-method" data-x-href="https://httpwg.org/specs/rfc7231.html#idempotent.methods">idempotent method</dfn></li>
25372539
<li>`<dfn data-x="http-accept" data-x-href="https://httpwg.org/specs/rfc7231.html#header.accept"><code>Accept</code></dfn>` header</li>
25382540
<li>`<dfn data-x="http-accept-language" data-x-href="https://httpwg.org/specs/rfc7231.html#header.accept-language"><code>Accept-Language</code></dfn>` header</li>
25392541
<li>`<dfn data-x="http-cache-control" data-x-href="https://httpwg.org/specs/rfc7234.html#header.cache-control"><code>Cache-Control</code></dfn>` header</li>
@@ -60533,6 +60535,7 @@ fur
6053360535
<tr>
6053460536
<td>
6053560537
<th> <span data-x="attr-fs-method-GET">GET</span>
60538+
<th> <span data-x="attr-fs-method-POST">DELETE</span>
6053660539
<th> <span data-x="attr-fs-method-POST">POST</span>
6053760540
<th> <span data-x="attr-fs-method-POST">PUT</span>
6053860541
<th> <span data-x="attr-fs-method-POST">PATCH</span>
@@ -60541,13 +60544,19 @@ fur
6054160544
<tr>
6054260545
<th> <code data-x="">http</code>
6054360546
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60547+
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60548+
<td> <span data-x="submit-body">Submit as entity body</span>
60549+
<td> <span data-x="submit-body">Submit as entity body</span>
6054460550
<td> <span data-x="submit-body">Submit as entity body</span>
6054560551
<td> <span data-x="submit-body">Submit as entity body</span>
6054660552
<td> <span data-x="submit-body">Submit as entity body</span>
6054760553
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
6054860554
<tr>
6054960555
<th> <code data-x="">https</code>
6055060556
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60557+
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60558+
<td> <span data-x="submit-body">Submit as entity body</span>
60559+
<td> <span data-x="submit-body">Submit as entity body</span>
6055160560
<td> <span data-x="submit-body">Submit as entity body</span>
6055260561
<td> <span data-x="submit-body">Submit as entity body</span>
6055360562
<td> <span data-x="submit-body">Submit as entity body</span>
@@ -60569,13 +60578,19 @@ fur
6056960578
<tr>
6057060579
<th> <code data-x="">data</code>
6057160580
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60581+
<td> <span data-x="submit-mutate-action">Mutate action URL</span>
60582+
<td> <span data-x="submit-get-action">Get action URL</span>
60583+
<td> <span data-x="submit-get-action">Get action URL</span>
6057260584
<td> <span data-x="submit-get-action">Get action URL</span>
6057360585
<td> <span data-x="submit-get-action">Get action URL</span>
6057460586
<td> <span data-x="submit-get-action">Get action URL</span>
6057560587
<td> <span data-x="submit-get-action">Mutate action URL</span>
6057660588
<tr>
6057760589
<th> <code data-x="">mailto</code>
6057860590
<td> <span data-x="submit-mailto-headers">Mail with headers</span>
60591+
<td> <span data-x="submit-mailto-headers">Mail with headers</span>
60592+
<td> <span data-x="submit-mailto-body">Mail as body</span>
60593+
<td> <span data-x="submit-mailto-body">Mail as body</span>
6057960594
<td> <span data-x="submit-mailto-body">Mail as body</span>
6058060595
<td> <span data-x="submit-mailto-body">Mail as body</span>
6058160596
<td> <span data-x="submit-mailto-body">Mail as body</span>
@@ -60612,7 +60627,8 @@ fur
6061260627
<li><p>Set the <code>form</code>'s <span>planned navigation</span> to null.</p></li>
6061360628

6061460629
<li><p><span>Navigate</span><!--DONAV form--> <var>targetNavigable</var> to <var>url</var>
60615-
using the <code>form</code> element's <span>node document</span>, with <i
60630+
using the <code>form</code> element's <span>node document</span>,
60631+
with <i data-x="navigation-method">method</i> set to <var>method</var>, with <i
6061660632
data-x="navigation-hh">historyHandling</i> set to <var>historyHandling</var>, <i
6061760633
data-x="navigation-user-involvement">userInvolvement</i> set to <var>userInvolvement</var>,
6061860634
<i data-x="navigation-source-element">sourceElement</i> set to <var>submitter</var>,
@@ -96317,8 +96333,8 @@ callback <dfn callback>NavigationInterceptHandler</dfn> = <span data-x="idl-Prom
9631796333
<dd>
9631896334
<p>The <code>FormData</code> representing the submitted form entries for this navigation, if
9631996335
this navigation is a "<code data-x="dom-NavigationType-push">push</code>" or "<code
96320-
data-x="dom-NavigationType-replace">replace</code>" navigation representing a POST <span
96321-
data-x="concept-form-submit">form submission</span>; null otherwise.</p>
96336+
data-x="dom-NavigationType-replace">replace</code>" navigation representing a POST, PUT, or
96337+
PATCH <span data-x="concept-form-submit">form submission</span>; null otherwise.</p>
9632296338

9632396339
<p>(Notably, this will be null even for "<code data-x="dom-NavigationType-reload">reload</code>"
9632496340
or "<code data-x="dom-NavigationType-traverse">traverse</code>" navigations that are revisiting
@@ -100214,6 +100230,9 @@ interface <dfn interface>NotRestoredReasons</dfn> {
100214100230

100215100231
<li><p><dfn data-x="she-url">URL</dfn>, a <span>URL</span></p></li>
100216100232

100233+
<li><p><dfn data-x="she-method">method</dfn>, an HTTP request
100234+
<span data-x="http-method">method</span>, initially set to GET</p></li>
100235+
100217100236
<li><p><dfn data-x="she-document-state">document state</dfn>, a <span>document
100218100237
state</span>.</p></li>
100219100238

@@ -101257,7 +101276,9 @@ location.href = '#foo';</code></pre>
101257101276
<span>URL</span> <var>url</var> using an optional <code>Document</code>-or-null <var
101258101277
id="source-browsing-context">sourceDocument</var> (default null), with an optional <span>request
101259101278
resource</span>, string, or null <dfn for="navigate" data-x="navigation-resource"
101260-
export><var>documentResource</var></dfn> (default null), an optional <span
101279+
export><var>documentResource</var></dfn> (default null), an optional request
101280+
<span data-x="http-method">method</span> <dfn for="navigate"
101281+
data-x="navigation-method">method</dfn>, an optional <span
101261101282
data-x="concept-response">response</span>-or-null <dfn for="navigate" data-x="navigation-response"
101262101283
export><var>response</var></dfn> (default null), an optional boolean <dfn for="navigate"
101263101284
id="exceptions-enabled" export><var>exceptionsEnabled</var></dfn> (default false), an optional
@@ -101605,8 +101626,8 @@ location.href = '#foo';</code></pre>
101605101626
</li>
101606101627

101607101628
<li><p>Let <var>historyEntry</var> be a new <span>session history entry</span>, with its <span
101608-
data-x="she-url">URL</span> set to <var>url</var> and its <span
101609-
data-x="she-document-state">document state</span> set to
101629+
data-x="she-url">URL</span> set to <var>url</var>, its <span data-x="she-method">method</span>
101630+
set to <var>method</var> and its <span data-x="she-document-state">document state</span> set to
101610101631
<var>documentState</var>.</p></li>
101611101632

101612101633
<li><p>Let <var>navigationParams</var> be null.</p></li>
@@ -103595,8 +103616,8 @@ location.href = '#foo';</code></pre>
103595103616
<p>If <var>documentResource</var> is a <span>request resource</span>:</p>
103596103617

103597103618
<ol>
103598-
<li><p>Set <var>request</var>'s <span data-x="concept-request-method">method</span> to `<code
103599-
data-x="">POST</code>`.</p></li>
103619+
<li><p>Set <var>request</var>'s <span data-x="concept-request-method">method</span> to
103620+
<var>entry</var>'s <span data-x="she-method">method</span>.</p></li>
103600103621

103601103622
<li><p>Set <var>request</var>'s <span data-x="concept-request-body">body</span> to
103602103623
<var>documentResource</var>'s <span data-x="request-resource-request-body">request
@@ -104633,7 +104654,7 @@ location.href = '#foo';</code></pre>
104633104654
<li><p><span>In parallel</span>, <span>attempt to populate the history entry's
104634104655
document</span> for <var>targetEntry</var>, given <var>navigable</var>,
104635104656
<var>potentiallyTargetSpecificSourceSnapshotParams</var>, <var>targetSnapshotParams</var>,
104636-
<var>userInvolvement</var>, with <i data-x="attempt-to-populate-allow-post">allowUnsafe</i>
104657+
<var>userInvolvement</var>, with <i data-x="attempt-to-populate-allow-unsafe">allowUnsafe</i>
104637104658
set to <var>allowUnsafe</var> and <span data-x="attempt-to-populate-completion-steps">
104638104659
<i>completionSteps</i></span> set to <span>queue a global task</span> on the <span>navigation
104639104660
and traversal task source</span> given <var>navigable</var>'s
@@ -107692,10 +107713,9 @@ new PaymentRequest(&hellip;); // Allowed to use
107692107713

107693107714
<p>When a user requests a <span>reload</span> of a <span>navigable</span> whose <span
107694107715
data-x="nav-active-history-entry">active session history entry</span>'s <span
107695-
data-x="she-document-state">document state</span>'s <span
107696-
data-x="document-state-resource">resource</span> is a <span>request resource</span>, the user agent
107697-
should prompt the user to confirm the operation first, since otherwise transactions (e.g.,
107698-
purchases or database modifications) could be repeated.</p>
107716+
data-x="she-method">method</span> is a non-<span data-x="http-idempotent-method">idempotent</span>
107717+
method, the user agent should prompt the user to confirm the operation first, since otherwise
107718+
transcations (e.g. purchases or database modifications) could be repeated.</p>
107699107719

107700107720
<p>When a user requests a <span>reload</span> of a <span>navigable</span>, user agents may provide
107701107721
a mechanism for ignoring any caches when reloading.</p>
@@ -147424,6 +147444,7 @@ INSERT INTERFACES HERE
147424147444
Alexander Farkas,
147425147445
Alexander J. Vincent,
147426147446
Alexander Kalenik,
147447+
Alexander Petros,
147427147448
Alexandre Dieulot,
147428147449
Alexandre Morgaut,
147429147450
Alexey Feldgendler,

0 commit comments

Comments
 (0)