Initial spec-incompliant implementation of default click action for anchor elements.

This is cherry-picked from https://github.com/mozilla/servo/pull/1688:

  * Initial spec-incompliant implementation of default click action for anchor elements.
  * Add documentation; gut the new document URL loading method
    and move it all into the new Window method.
  * Add test for default event prevention.

Original developer: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Tetsuharu OHZEKI 2014-05-14 08:31:50 +09:00
parent c753f3ee05
commit 46d31632e0
7 changed files with 169 additions and 39 deletions

View file

@ -83,6 +83,7 @@ pub trait DocumentHelpers {
fn wait_until_safe_to_modify_dom(&self);
fn unregister_named_element(&mut self, to_unregister: &JSRef<Element>, id: DOMString);
fn register_named_element(&mut self, element: &JSRef<Element>, id: DOMString);
fn load_anchor_href(&self, href: DOMString);
}
impl<'a> DocumentHelpers for JSRef<'a, Document> {
@ -176,6 +177,11 @@ impl<'a> DocumentHelpers for JSRef<'a, Document> {
elements.push_unrooted(element);
self.idmap.insert(id, elements);
}
fn load_anchor_href(&self, href: DOMString) {
let mut window = self.window.root();
window.load_url(href);
}
}
impl Document {