mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Move attributes-related functions onto JS<Element>.
This commit is contained in:
parent
0265fb9784
commit
038a195ead
10 changed files with 272 additions and 240 deletions
|
@ -15,7 +15,7 @@ use dom::comment::Comment;
|
|||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::domimplementation::DOMImplementation;
|
||||
use dom::element::{Element};
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId};
|
||||
use dom::element::{HTMLBodyElementTypeId, HTMLFrameSetElementTypeId};
|
||||
use dom::event::Event;
|
||||
|
@ -435,7 +435,7 @@ impl Document {
|
|||
}
|
||||
|
||||
let element: JS<Element> = ElementCast::to(node).unwrap();
|
||||
element.get().get_attribute(Null, "name").map_or(false, |attr| {
|
||||
element.get_attribute(Null, "name").map_or(false, |attr| {
|
||||
attr.get().value_ref() == name
|
||||
})
|
||||
})
|
||||
|
@ -460,7 +460,7 @@ impl Document {
|
|||
// FIXME: https://github.com/mozilla/servo/issues/1847
|
||||
HTMLCollection::create(&self.window, &NodeCast::from(abstract_self), |elem| {
|
||||
("a" == elem.get().tag_name || "area" == elem.get().tag_name) &&
|
||||
elem.get().get_attribute(Null, "href").is_some()
|
||||
elem.get_attribute(Null, "href").is_some()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ impl Document {
|
|||
pub fn Anchors(&self, abstract_self: &JS<Document>) -> JS<HTMLCollection> {
|
||||
// FIXME: https://github.com/mozilla/servo/issues/1847
|
||||
HTMLCollection::create(&self.window, &NodeCast::from(abstract_self), |elem| {
|
||||
"a" == elem.get().tag_name && elem.get().get_attribute(Null, "name").is_some()
|
||||
"a" == elem.get().tag_name && elem.get_attribute(Null, "name").is_some()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue