mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Move HTMLDocument members to Document.
This commit is contained in:
parent
2c8107e811
commit
7190feb5e3
4 changed files with 48 additions and 52 deletions
|
@ -431,6 +431,44 @@ impl Document {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn Images(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| "img" == elem.tag_name)
|
||||
}
|
||||
|
||||
pub fn Embeds(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| "embed" == elem.tag_name)
|
||||
}
|
||||
|
||||
pub fn Plugins(&self) -> JS<HTMLCollection> {
|
||||
self.Embeds()
|
||||
}
|
||||
|
||||
pub fn Links(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| {
|
||||
("a" == elem.tag_name || "area" == elem.tag_name) &&
|
||||
elem.get_attribute(Null, "href").is_some()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Forms(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| "form" == elem.tag_name)
|
||||
}
|
||||
|
||||
pub fn Scripts(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| "script" == elem.tag_name)
|
||||
}
|
||||
|
||||
pub fn Anchors(&self) -> JS<HTMLCollection> {
|
||||
self.createHTMLCollection(|elem| {
|
||||
"a" == elem.tag_name && elem.get_attribute(Null, "name").is_some()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Applets(&self) -> JS<HTMLCollection> {
|
||||
// FIXME: This should be return OBJECT elements containing applets.
|
||||
self.createHTMLCollection(|elem| "applet" == elem.tag_name)
|
||||
}
|
||||
|
||||
pub fn createHTMLCollection(&self, callback: |elem: &Element| -> bool) -> JS<HTMLCollection> {
|
||||
let mut elements = ~[];
|
||||
match self.GetDocumentElement() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue