mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue