mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
LibWeb: Implement URLSearchParams.getAll
This commit is contained in:
parent
09d1db5afd
commit
fb321bad35
3 changed files with 14 additions and 1 deletions
|
@ -131,6 +131,18 @@ String URLSearchParams::get(String const& name)
|
|||
return result->value;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
||||
Vector<String> URLSearchParams::get_all(String const& name)
|
||||
{
|
||||
// return the values of all name-value pairs whose name is name, in this’s list, in list order, and the empty sequence otherwise.
|
||||
Vector<String> values;
|
||||
for (auto& entry : m_list) {
|
||||
if (entry.name == name)
|
||||
values.append(entry.value);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
bool URLSearchParams::has(String const& name)
|
||||
{
|
||||
// return true if there is a name-value pair whose name is name in this’s list, and false otherwise.
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
void append(String const& name, String const& value);
|
||||
void delete_(String const& name);
|
||||
String get(String const& name);
|
||||
Vector<String> get_all(String const& name);
|
||||
bool has(String const& name);
|
||||
void set(String const& name, String const& value);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ interface URLSearchParams {
|
|||
undefined append(USVString name, USVString value);
|
||||
undefined delete(USVString name);
|
||||
USVString? get(USVString name);
|
||||
// TODO: sequence<USVString> getAll(USVString name);
|
||||
sequence<USVString> getAll(USVString name);
|
||||
boolean has(USVString name);
|
||||
undefined set(USVString name, USVString value);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue