mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibWeb: Add size to URLSearchParams
Added new size parameter to URLSearchParams. Spec: https://url.spec.whatwg.org/#dom-urlsearchparams-size Co-Authored-By: Linus Groh <mail@linusgroh.de>
This commit is contained in:
parent
e231f72f61
commit
3e2ceef8c3
3 changed files with 10 additions and 0 deletions
|
@ -149,6 +149,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<URLSearchParams>> URLSearchParams::construc
|
||||||
return URLSearchParams::create(realm, url_decode(stripped_init));
|
return URLSearchParams::create(realm, url_decode(stripped_init));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://url.spec.whatwg.org/#dom-urlsearchparams-size
|
||||||
|
size_t URLSearchParams::size() const
|
||||||
|
{
|
||||||
|
// The size getter steps are to return this’s list’s size.
|
||||||
|
return m_list.size();
|
||||||
|
}
|
||||||
|
|
||||||
void URLSearchParams::append(DeprecatedString const& name, DeprecatedString const& value)
|
void URLSearchParams::append(DeprecatedString const& name, DeprecatedString const& value)
|
||||||
{
|
{
|
||||||
// 1. Append a new name-value pair whose name is name and value is value, to list.
|
// 1. Append a new name-value pair whose name is name and value is value, to list.
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
|
|
||||||
virtual ~URLSearchParams() override;
|
virtual ~URLSearchParams() override;
|
||||||
|
|
||||||
|
size_t size() const;
|
||||||
void append(DeprecatedString const& name, DeprecatedString const& value);
|
void append(DeprecatedString const& name, DeprecatedString const& value);
|
||||||
void delete_(DeprecatedString const& name);
|
void delete_(DeprecatedString const& name);
|
||||||
DeprecatedString get(DeprecatedString const& name);
|
DeprecatedString get(DeprecatedString const& name);
|
||||||
|
|
|
@ -4,6 +4,8 @@ interface URLSearchParams {
|
||||||
|
|
||||||
constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = "");
|
constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = "");
|
||||||
|
|
||||||
|
readonly attribute unsigned long size;
|
||||||
|
|
||||||
undefined append(USVString name, USVString value);
|
undefined append(USVString name, USVString value);
|
||||||
undefined delete(USVString name);
|
undefined delete(USVString name);
|
||||||
USVString? get(USVString name);
|
USVString? get(USVString name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue