mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Implement Location.hash.
This commit is contained in:
parent
ecd816cdd6
commit
4225cdcac3
2 changed files with 9 additions and 0 deletions
|
@ -37,6 +37,7 @@ impl Location {
|
||||||
pub trait LocationMethods {
|
pub trait LocationMethods {
|
||||||
fn Href(&self) -> DOMString;
|
fn Href(&self) -> DOMString;
|
||||||
fn Search(&self) -> DOMString;
|
fn Search(&self) -> DOMString;
|
||||||
|
fn Hash(&self) -> DOMString;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> LocationMethods for JSRef<'a, Location> {
|
impl<'a> LocationMethods for JSRef<'a, Location> {
|
||||||
|
@ -50,6 +51,13 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
|
||||||
Some(ref query) => "?".to_string().append(query.as_slice())
|
Some(ref query) => "?".to_string().append(query.as_slice())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn Hash(&self) -> DOMString {
|
||||||
|
match self.page.get_url().fragment {
|
||||||
|
None => "".to_string(),
|
||||||
|
Some(ref query) => "#".to_string().append(query.as_slice())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for Location {
|
impl Reflectable for Location {
|
||||||
|
|
|
@ -21,4 +21,5 @@ interface URLUtils {
|
||||||
readonly attribute DOMString search;
|
readonly attribute DOMString search;
|
||||||
// attribute URLSearchParams searchParams;
|
// attribute URLSearchParams searchParams;
|
||||||
// attribute ScalarValueString hash;
|
// attribute ScalarValueString hash;
|
||||||
|
readonly attribute DOMString hash;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue