Merge pull request #3081 from Ms2ger/location-empty

Return the empty string as appropriate for location.{search,hash}; r=Manishearth
This commit is contained in:
Ms2ger 2014-08-14 10:50:12 +02:00
commit 984ec0e0c3

View file

@ -43,6 +43,7 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
fn Search(&self) -> DOMString {
match self.page.get_url().query {
None => "".to_string(),
Some(ref query) if query.as_slice() == "" => "".to_string(),
Some(ref query) => "?".to_string().append(query.as_slice())
}
}
@ -50,7 +51,8 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
fn Hash(&self) -> DOMString {
match self.page.get_url().fragment {
None => "".to_string(),
Some(ref query) => "#".to_string().append(query.as_slice())
Some(ref hash) if hash.as_slice() == "" => "".to_string(),
Some(ref hash) => "#".to_string().append(hash.as_slice())
}
}
}