From d43d0fb18d0b2400d95999aa61db871f48c99a0e Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 8 Nov 2016 09:54:46 +0100 Subject: Implement HTMLAnchorElement.origin --- components/script/dom/htmlanchorelement.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'components/script/dom/htmlanchorelement.rs') 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. -- cgit v1.2.3