Make sure getElementById always returns the first element with the given ID in tree order.(fixes #1822)

This commit is contained in:
lpy 2014-03-14 22:32:15 +08:00
parent 86c83f7bfc
commit 50aea70f98
3 changed files with 77 additions and 8 deletions

View file

@ -352,7 +352,7 @@ impl AttributeHandlers for JS<Element> {
// "borrowed value does not live long enough"
let mut doc = node.get().owner_doc().clone();
let doc = doc.get_mut();
doc.unregister_named_element(old_value);
doc.unregister_named_element(self, old_value);
}
_ => ()
}
@ -640,7 +640,7 @@ impl IElement for JS<Element> {
match self.get_attribute(Null, "id") {
Some(attr) => {
let mut doc = document_from_node(self);
doc.get_mut().unregister_named_element(attr.get().Value());
doc.get_mut().unregister_named_element(self, attr.get().Value());
}
_ => ()
}