diff options
author | Lino Le Van <11367844+lino-levan@users.noreply.github.com> | 2023-03-14 13:28:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 20:28:33 +0000 |
commit | eb990efcce1e5390e4ed76b858c05c6f9b3b6c11 (patch) | |
tree | 441a5d2f9430f354fb84a9be84e19e8844781982 | |
parent | 1930c09b04bbf2150a601c0fe47c44750d8c2b57 (diff) |
feat(ext/url): URLSearchParams.size (#17884)
-rw-r--r-- | ext/url/00_url.js | 5 | ||||
-rw-r--r-- | ext/url/lib.deno_url.d.ts | 8 | ||||
-rw-r--r-- | tools/wpt/expectation.json | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ext/url/00_url.js b/ext/url/00_url.js index 422a23930..c288225e3 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -302,6 +302,11 @@ class URLSearchParams { webidl.assertBranded(this, URLSearchParamsPrototype); return ops.op_url_stringify_search_params(this[_list]); } + + get size() { + webidl.assertBranded(this, URLSearchParamsPrototype); + return this[_list].length; + } } webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1); diff --git a/ext/url/lib.deno_url.d.ts b/ext/url/lib.deno_url.d.ts index 329f5bf55..0181c6fb3 100644 --- a/ext/url/lib.deno_url.d.ts +++ b/ext/url/lib.deno_url.d.ts @@ -150,6 +150,14 @@ declare class URLSearchParams { * ``` */ toString(): string; + + /** Contains the number of search parameters + * + * ```ts + * searchParams.size + * ``` + */ + size: number; } /** The URL interface represents an object providing static methods used for diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 52011ec1e..885354a45 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -2090,6 +2090,7 @@ "urlsearchparams-has.any.worker.html": true, "urlsearchparams-set.any.html": true, "urlsearchparams-set.any.worker.html": true, + "urlsearchparams-size.any.html": true, "urlsearchparams-sort.any.html": true, "urlsearchparams-sort.any.worker.html": true, "urlsearchparams-stringifier.any.html": true, |