Skip to content

Commit

Permalink
add algorithm wrappers while here
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed May 5, 2023
1 parent b3e1768 commit b5bcae8
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions url.bs
Expand Up @@ -3422,8 +3422,9 @@ console.log(url.searchParams.get('b')); // "~"</code></pre>
the potential to change that object's <a for=url>path</a> in a manner equivalent to the {{URL}}
object's {{URL/search}} and {{URL/hash}} setters.

<div algorithm>
<p>To <dfn for=URLSearchParams oldids=concept-urlsearchparams-new>initialize</dfn> a
{{URLSearchParams}} object <var>query</var> with <var>init</var>, run these steps:
{{URLSearchParams}} object <var>query</var> with <var>init</var>:

<ol>
<li>
Expand Down Expand Up @@ -3452,9 +3453,11 @@ object's {{URL/search}} and {{URL/hash}} setters.
<a lt="urlencoded string parser">parsing</a> <var>init</var>.
</ol>
</ol>
</div>

<div algorithm>
<p>To <dfn for=URLSearchParams id=concept-urlsearchparams-update>update</dfn> a {{URLSearchParams}}
object <var>query</var>, run these steps:
object <var>query</var>:

<ol>
<li><p>If <var>query</var>'s <a for=URLSearchParams>URL object</a> is null, then return.
Expand All @@ -3472,7 +3475,9 @@ object <var>query</var>, run these steps:
<a>potentially strip trailing spaces from an opaque path</a> with <var>query</var>'s
<a for=URLSearchParams>URL object</a>.
</ol>
</div>

<div algorithm>
<p>The
<dfn constructor for=URLSearchParams lt="URLSearchParams(init)"><code>new URLSearchParams(<var>init</var>)</code></dfn>
constructor steps are:</p>
Expand All @@ -3483,7 +3488,9 @@ constructor steps are:</p>

<li><p><a for=URLSearchParams>Initialize</a> <a>this</a> with <var>init</var>.
</ol>
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>append(<var>name</var>, <var>value</var>)</code></dfn>
method steps are:

Expand All @@ -3493,7 +3500,9 @@ method steps are:

<li><p><a for=URLSearchParams>Update</a> <a>this</a>.
</ol>
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>delete(<var>name</var>, <var>value</var>)</code></dfn>
method steps are:

Expand All @@ -3507,15 +3516,21 @@ method steps are:

<li><p><a for=URLSearchParams>Update</a> <a>this</a>.
</ol>
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>get(<var>name</var>)</code></dfn> method steps are to
return the value of the first <a for=/>tuple</a> whose name is <var>name</var> in <a>this</a>'s
<a for=URLSearchParams>list</a>, if there is such a <a for=/>tuple</a>; otherwise null.
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>getAll(<var>name</var>)</code></dfn> method steps are
to return the values of all <a for=/>tuples</a> whose name is <var>name</var> in <a>this</a>'s
<a for=URLSearchParams>list</a>, in list order; otherwise the empty sequence.
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>has(<var>name</var>, <var>value</var>)</code></dfn>
method steps are:

Expand All @@ -3528,7 +3543,9 @@ method steps are:

<li><p>Return false.
</ol>
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>set(<var>name</var>, <var>value</var>)</code></dfn>
method steps are:

Expand All @@ -3542,6 +3559,7 @@ method steps are:

<li><p><a for=URLSearchParams>Update</a> <a>this</a>.
</ol>
</div>

<hr>

Expand All @@ -3563,6 +3581,7 @@ const sorted = new URLSearchParams(url.search)
sorted.sort()</code></pre>
</div>

<div algorithm>
<p>The <dfn method for=URLSearchParams><code>sort()</code></dfn> method steps are:

<ol>
Expand All @@ -3572,6 +3591,7 @@ sorted.sort()</code></pre>

<li><p><a for=URLSearchParams>Update</a> <a>this</a>.
</ol>
</div>

<hr>

Expand Down

0 comments on commit b5bcae8

Please sign in to comment.