diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-11-08 09:54:46 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-11-08 09:54:46 +0100 |
commit | d43d0fb18d0b2400d95999aa61db871f48c99a0e (patch) | |
tree | 45d0528b96860d1f912224a4379bb871b07082bd /components | |
parent | f1c3e97fb47b6fbe1d82ebb30a38ab7afd4fe0b8 (diff) | |
download | servo-d43d0fb18d0b2400d95999aa61db871f48c99a0e.tar.gz servo-d43d0fb18d0b2400d95999aa61db871f48c99a0e.zip |
Implement HTMLAnchorElement.origin
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/htmlanchorelement.rs | 17 | ||||
-rw-r--r-- | components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 7683fc02330..24d86df0cc0 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -284,6 +284,23 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement { self.set_url(); } + // https://html.spec.whatwg.org/multipage/#dom-hyperlink-origin + fn Origin(&self) -> USVString { + // Step 1. + self.reinitialize_url(); + + USVString(match *self.url.borrow() { + None => { + // Step 2. + "".to_owned() + }, + Some(ref url) => { + // Step 3. + url.origin().unicode_serialization() + }, + }) + } + // https://html.spec.whatwg.org/multipage/#dom-hyperlink-password fn Password(&self) -> USVString { // Step 1. diff --git a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl index 3ff0418b13f..a75ecb970a0 100644 --- a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl +++ b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl @@ -7,7 +7,7 @@ interface HTMLHyperlinkElementUtils { // stringifier attribute USVString href; attribute USVString href; -// attribute USVString origin; + readonly attribute USVString origin; attribute USVString protocol; attribute USVString username; attribute USVString password; |