Skip to content

Commit 8c212e5

Browse files
tkent-googleannevk
authored andcommitted
Move _charset_ handling to construct the form data set
This makes the algorithms match Chrome, Firefox, and Safari. Change to the URL Standard: whatwg/url#382. Tests: web-platform-tests/wpt#10623. Fixes #3560.
1 parent 3072f1d commit 8c212e5

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

source

+27-30
Original file line numberDiff line numberDiff line change
@@ -55852,12 +55852,12 @@ fur
5585255852

5585355853
<!-- unlock -->
5585455854

55855-
<li><p>Let <var>form data set</var> be the result of <span>constructing the form data
55856-
set</span> for <var>form</var> in the context of <var>submitter</var>.</p></li>
55857-
5585855855
<li><p>Let <var>encoding</var> be the result of <span>picking an encoding for the
5585955856
form</span>.</p>
5586055857

55858+
<li><p>Let <var>form data set</var> be the result of <span>constructing the form data
55859+
set</span> with <var>form</var>, <var>submitter</var>, and <var>encoding</var>.</p></li>
55860+
5586155861
<li><p>Let <var>action</var> be the <var>submitter</var> element's <span
5586255862
data-x="concept-fs-action">action</span>.</p></li>
5586355863

@@ -56050,7 +56050,7 @@ fur
5605056050

5605156051
<dd>
5605256052
<p>Let <var>body</var> be the result of running the <span><code data-x="">text/plain</code>
56053-
encoding algorithm</span> with <var>form data set</var> and <var>encoding</var>.</p>
56053+
encoding algorithm</span> with <var>form data set</var>.</p>
5605456054

5605556055
<p>Set <var>body</var> to the result of <span data-x="encode">encoding</span>
5605656056
<var>body</var> using <var>encoding</var>.</p>
@@ -56100,9 +56100,8 @@ fur
5610056100
<dt><code data-x="attr-fs-enctype-text">text/plain</code></dt>
5610156101

5610256102
<dd>
56103-
<p>Let <var>body</var> be the result of running the <span><code
56104-
data-x="">text/plain</code> encoding algorithm</span> with <var>form data set</var> and
56105-
<var>encoding</var>.</p>
56103+
<p>Let <var>body</var> be the result of running the <span><code data-x="">text/plain</code>
56104+
encoding algorithm</span> with <var>form data set</var>.</p>
5610656105

5610756106
<p>Set <var>body</var> to the result of concatenating the result of <span data-x="UTF-8
5610856107
percent encode">UTF-8 percent encoding</span> each code point in <var>body</var>, using the
@@ -56168,9 +56167,9 @@ fur
5616856167
<h5 id="constructing-form-data-set">Constructing the form data set</h5>
5616956168

5617056169
<p>The algorithm to <dfn data-x="constructing the form data set" data-export=""
56171-
data-lt="constructing the form data set">construct the form data set</dfn> for a form
56172-
<var>form</var> optionally in the context of a submitter <var>submitter</var> is as follows. If
56173-
not specified otherwise, <var>submitter</var> is null.</p>
56170+
data-lt="constructing the form data set">construct the form data set</dfn> given a form
56171+
<var>form</var>, an optional submitter <var>submitter</var>, and an optional <var>encoding</var>,
56172+
is as follows. If not specified otherwise, <var>submitter</var> is null.</p>
5617456173

5617556174
<ol>
5617656175

@@ -56311,6 +56310,22 @@ fur
5631156310
name, the returned form submission value as the value, and the string "<code
5631256311
data-x="">object</code>" as the type.</p></li>
5631356312

56313+
<li>
56314+
<p>Otherwise, if the <var>field</var> element is an <code>input</code> element whose <code
56315+
data-x="attr-input-type">type</code> attribute is in the <span
56316+
data-x="attr-input-type-hidden">Hidden</span> state and <var>name</var> is "<code
56317+
data-x="attr-fe-name-charset">_charset_</code>":</p>
56318+
56319+
<ol>
56320+
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
56321+
<var>encoding</var> if <var>encoding</var> is given, and "<code data-x="">UTF-8</code>"
56322+
otherwise.</p></li>
56323+
56324+
<li><p>Append an entry to the <var>form data set</var> with <var>name</var> as the name,
56325+
<var>charset</var> as the value, and <var>type</var> as the type.</p></li>
56326+
</ol>
56327+
</li>
56328+
5631456329
<li><p>Otherwise, append an entry to the <var>form data set</var> with <var>name</var> as the name, the <span data-x="concept-fe-value">value</span> of the <var>field</var> element as the value, and <var>type</var> as the type.</p></li>
5631556330

5631656331
<li>
@@ -56436,18 +56451,12 @@ fur
5643656451

5643756452
<li><p>Let <var>result</var> be the empty string.</p></li>
5643856453

56439-
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
56440-
<var>encoding</var>.</p></li>
56441-
5644256454
<li>
5644356455

5644456456
<p>For each entry in the <var>form data set</var>:</p>
5644556457

5644656458
<ol>
5644756459

56448-
<li><p>If the entry's name is "<code data-x="attr-fe-name-charset">_charset_</code>" and its
56449-
type is "<code data-x="">hidden</code>", replace its value with <var>charset</var>.</p></li>
56450-
5645156460
<!-- the step that replaces a file with its name is missing in
5645256461
this version of the algorithm -->
5645356462

@@ -56505,24 +56514,15 @@ fur
5650556514
<div w-nodev>
5650656515

5650756516
<p>The <dfn><code data-x="">text/plain</code> encoding algorithm</dfn>, given a <var>form data
56508-
set</var> and <var>encoding</var>, is as follows:</p>
56517+
set</var>, is as follows:</p>
5650956518

5651056519
<ol>
56511-
5651256520
<li><p>Let <var>result</var> be the empty string.</p></li>
5651356521

56514-
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
56515-
<var>encoding</var>.</p></li>
56516-
5651756522
<li>
56518-
5651956523
<p>For each entry in the <var>form data set</var>:</p>
5652056524

5652156525
<ol>
56522-
56523-
<li><p>If the entry's name is "<code data-x="attr-fe-name-charset">_charset_</code>" and its
56524-
type is "<code data-x="">hidden</code>", replace its value with <var>charset</var>.</p></li>
56525-
5652656526
<li><p>If the entry's type is "<code data-x="">file</code>", replace its value with the file's
5652756527
name only.</p></li>
5652856528

@@ -56533,13 +56533,10 @@ fur
5653356533
<li><p>Append the entry's value to <var>result</var>.</p></li>
5653456534

5653556535
<li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) character pair to <var>result</var>.</p></li>
56536-
5653756536
</ol>
56538-
5653956537
</li>
5654056538

5654156539
<li><p>Return <var>result</var>.</p></li>
56542-
5654356540
</ol>
5654456541

5654556542
</div>
@@ -121443,7 +121440,7 @@ INSERT INTERFACES HERE
121443121440
Takayoshi Kochi,
121444121441
Takeshi Yoshino,
121445121442
<span data-x="" lang="tr">Tantek &Ccedil;elik</span>,
121446-
&#30000;&#26449;&#20581;&#20154; (TAMURA Kent),
121443+
田村健人 (Kent TAMURA),
121447121444
Taylor Hunt,
121448121445
Ted Mielczarek,
121449121446
Terrence Wood,

0 commit comments

Comments
 (0)