Implement URLSearchParams::getAll

This commit is contained in:
Fernando Martins 2016-01-15 22:40:55 +00:00
parent 4cb2c87982
commit 29b14d4b3d
4 changed files with 13 additions and 16 deletions

View file

@ -87,6 +87,18 @@ impl URLSearchParamsMethods for URLSearchParams {
}).next()
}
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
fn GetAll(&self, name: USVString) -> Vec<USVString> {
let list = self.list.borrow();
list.iter().filter_map(|&(ref k, ref v)| {
if k == &name.0 {
Some(USVString(v.clone()))
} else {
None
}
}).collect()
}
// https://url.spec.whatwg.org/#dom-urlsearchparams-has
fn Has(&self, name: USVString) -> bool {
let list = self.list.borrow();