Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make URLSearchParams' record constructor more flexible #204

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2756,7 +2756,7 @@ steps:
<h3 id=interface-urlsearchparams>Interface {{URLSearchParams}}</h3>

<pre class=idl>
[Constructor(optional (sequence&lt;sequence&lt;USVString>> or record&lt;USVString, USVString> or USVString) init = ""),
[Constructor(optional (sequence&lt;sequence&lt;USVString>> or record&lt;USVString, (USVString or sequence&lt;USVString>)> or USVString) init = ""),
Exposed=(Window,Worker)]
interface URLSearchParams {
void append(USVString name, USVString value);
Expand Down Expand Up @@ -2803,9 +2803,17 @@ initially null.
</ol>

<li><p>Otherwise, if <var>init</var> is a <a>record</a>, then for each <a for=record>mapping</a>
(<var>name</var>, <var>value</var>) in <var>init</var>, append a new name-value pair whose name is
<var>name</var> and value is <var>value</var>, to <var>query</var>'s
<a for=URLSearchParams>list</a>.
(<var>name</var>, <var>value</var>) in <var>init</var>, run these steps:

<ol>
<li><p>If <var>value</var> is a <a>sequence</a>, then for each <var>innerValue</var> in
<var>value</var>, append a new name-value pair whose name is <var>name</var> and value is
<var>innerValue</var>, to <var>query</var>'s <a for=URLSearchParams>list</a>.

<li><p>Otherwise, <var>value</var> is a string, then append a new name-value pair whose name is
<var>name</var> and value is <var>value</var>, to <var>query</var>'s
<a for=URLSearchParams>list</a>.
</ol>

<li><p>Otherwise, <var>init</var> is a string, then set <var>query</var>'s
<a for=URLSearchParams>list</a> to the result of
Expand Down