Skip to content

Commit 420b35d

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 0b72080 commit 420b35d

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>,
@@ -96370,8 +96386,8 @@ callback <dfn callback>NavigationInterceptHandler</dfn> = <span data-x="idl-Prom
9637096386
<dd>
9637196387
<p>The <code>FormData</code> representing the submitted form entries for this navigation, if
9637296388
this navigation is a "<code data-x="dom-NavigationType-push">push</code>" or "<code
96373-
data-x="dom-NavigationType-replace">replace</code>" navigation representing a POST <span
96374-
data-x="concept-form-submit">form submission</span>; null otherwise.</p>
96389+
data-x="dom-NavigationType-replace">replace</code>" navigation representing a POST, PUT, or
96390+
PATCH <span data-x="concept-form-submit">form submission</span>; null otherwise.</p>
9637596391

9637696392
<p>(Notably, this will be null even for "<code data-x="dom-NavigationType-reload">reload</code>"
9637796393
or "<code data-x="dom-NavigationType-traverse">traverse</code>" navigations that are revisiting
@@ -100267,6 +100283,9 @@ interface <dfn interface>NotRestoredReasons</dfn> {
100267100283

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

100286+
<li><p><dfn data-x="she-method">method</dfn>, an HTTP request
100287+
<span data-x="http-method">method</span>, initially set to GET</p></li>
100288+
100270100289
<li><p><dfn data-x="she-document-state">document state</dfn>, a <span>document
100271100290
state</span>.</p></li>
100272100291

@@ -101310,7 +101329,9 @@ location.href = '#foo';</code></pre>
101310101329
<span>URL</span> <var>url</var> using an optional <code>Document</code>-or-null <var
101311101330
id="source-browsing-context">sourceDocument</var> (default null), with an optional <span>request
101312101331
resource</span>, string, or null <dfn for="navigate" data-x="navigation-resource"
101313-
export><var>documentResource</var></dfn> (default null), an optional <span
101332+
export><var>documentResource</var></dfn> (default null), an optional request
101333+
<span data-x="http-method">method</span> <dfn for="navigate"
101334+
data-x="navigation-method">method</dfn>, an optional <span
101314101335
data-x="concept-response">response</span>-or-null <dfn for="navigate" data-x="navigation-response"
101315101336
export><var>response</var></dfn> (default null), an optional boolean <dfn for="navigate"
101316101337
id="exceptions-enabled" export><var>exceptionsEnabled</var></dfn> (default false), an optional
@@ -101658,8 +101679,8 @@ location.href = '#foo';</code></pre>
101658101679
</li>
101659101680

101660101681
<li><p>Let <var>historyEntry</var> be a new <span>session history entry</span>, with its <span
101661-
data-x="she-url">URL</span> set to <var>url</var> and its <span
101662-
data-x="she-document-state">document state</span> set to
101682+
data-x="she-url">URL</span> set to <var>url</var>, its <span data-x="she-method">method</span>
101683+
set to <var>method</var> and its <span data-x="she-document-state">document state</span> set to
101663101684
<var>documentState</var>.</p></li>
101664101685

101665101686
<li><p>Let <var>navigationParams</var> be null.</p></li>
@@ -103648,8 +103669,8 @@ location.href = '#foo';</code></pre>
103648103669
<p>If <var>documentResource</var> is a <span>request resource</span>:</p>
103649103670

103650103671
<ol>
103651-
<li><p>Set <var>request</var>'s <span data-x="concept-request-method">method</span> to `<code
103652-
data-x="">POST</code>`.</p></li>
103672+
<li><p>Set <var>request</var>'s <span data-x="concept-request-method">method</span> to
103673+
<var>entry</var>'s <span data-x="she-method">method</span>.</p></li>
103653103674

103654103675
<li><p>Set <var>request</var>'s <span data-x="concept-request-body">body</span> to
103655103676
<var>documentResource</var>'s <span data-x="request-resource-request-body">request
@@ -104686,7 +104707,7 @@ location.href = '#foo';</code></pre>
104686104707
<li><p><span>In parallel</span>, <span>attempt to populate the history entry's
104687104708
document</span> for <var>targetEntry</var>, given <var>navigable</var>,
104688104709
<var>potentiallyTargetSpecificSourceSnapshotParams</var>, <var>targetSnapshotParams</var>,
104689-
<var>userInvolvement</var>, with <i data-x="attempt-to-populate-allow-post">allowUnsafe</i>
104710+
<var>userInvolvement</var>, with <i data-x="attempt-to-populate-allow-unsafe">allowUnsafe</i>
104690104711
set to <var>allowUnsafe</var> and <span data-x="attempt-to-populate-completion-steps">
104691104712
<i>completionSteps</i></span> set to <span>queue a global task</span> on the <span>navigation
104692104713
and traversal task source</span> given <var>navigable</var>'s
@@ -107745,10 +107766,9 @@ new PaymentRequest(&hellip;); // Allowed to use
107745107766

107746107767
<p>When a user requests a <span>reload</span> of a <span>navigable</span> whose <span
107747107768
data-x="nav-active-history-entry">active session history entry</span>'s <span
107748-
data-x="she-document-state">document state</span>'s <span
107749-
data-x="document-state-resource">resource</span> is a <span>request resource</span>, the user agent
107750-
should prompt the user to confirm the operation first, since otherwise transactions (e.g.,
107751-
purchases or database modifications) could be repeated.</p>
107769+
data-x="she-method">method</span> is a non-<span data-x="http-idempotent-method">idempotent</span>
107770+
method, the user agent should prompt the user to confirm the operation first, since otherwise
107771+
transcations (e.g. purchases or database modifications) could be repeated.</p>
107752107772

107753107773
<p>When a user requests a <span>reload</span> of a <span>navigable</span>, user agents may provide
107754107774
a mechanism for ignoring any caches when reloading.</p>
@@ -147477,6 +147497,7 @@ INSERT INTERFACES HERE
147477147497
Alexander Farkas,
147478147498
Alexander J. Vincent,
147479147499
Alexander Kalenik,
147500+
Alexander Petros,
147480147501
Alexandre Dieulot,
147481147502
Alexandre Morgaut,
147482147503
Alexey Feldgendler,

0 commit comments

Comments
 (0)