mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add/update comments with links to spec
Extracted out of #5649 * add more hyperlinks to associated specification for structs/methods * follow redirects and update links * replace broken links * removal of WHATWG multipage page name since the page name is not guaranteed to be stable
This commit is contained in:
parent
7f422e2076
commit
cc4a64e1fe
19 changed files with 112 additions and 35 deletions
|
@ -11,10 +11,12 @@ use std::borrow::ToOwned;
|
|||
pub struct UrlHelper;
|
||||
|
||||
impl UrlHelper {
|
||||
// https://url.spec.whatwg.org/#dom-urlutils-href
|
||||
pub fn Href(url: &Url) -> USVString {
|
||||
USVString(url.serialize())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlutils-search
|
||||
pub fn Search(url: &Url) -> USVString {
|
||||
USVString(match url.query {
|
||||
None => "".to_owned(),
|
||||
|
@ -23,6 +25,7 @@ impl UrlHelper {
|
|||
})
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlutils-hash
|
||||
pub fn Hash(url: &Url) -> USVString {
|
||||
USVString(match url.fragment {
|
||||
None => "".to_owned(),
|
||||
|
@ -31,8 +34,8 @@ impl UrlHelper {
|
|||
})
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlutils-pathname
|
||||
pub fn Pathname(url: &Url) -> USVString {
|
||||
// https://url.spec.whatwg.org/#dom-urlutils-pathname
|
||||
// FIXME: Url null check is skipped for now
|
||||
USVString(match url.scheme_data {
|
||||
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
|
||||
|
@ -40,7 +43,7 @@ impl UrlHelper {
|
|||
})
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#same-origin
|
||||
// https://html.spec.whatwg.org/multipage/#same-origin
|
||||
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
|
||||
if urlA.host() != urlB.host() {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue