1
Fork 0
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:
Luke Wilde 2021-10-26 22:06:55 +01:00 committed by Linus Groh
parent 09d1db5afd
commit fb321bad35
3 changed files with 14 additions and 1 deletions

View file

@ -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 thiss 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 thiss list, and false otherwise.