aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/htmldocument.rs
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2013-08-02 10:38:48 -0700
committerKeegan McAllister <kmcallister@mozilla.com>2013-08-02 10:38:48 -0700
commitfad7df8e7ad317a2c4e33b7a02a0f9f3a479a1ee (patch)
tree55cc6ce6cc0d2b37165509e439c8fc6ee9904b7e /src/components/script/dom/htmldocument.rs
parent5f62c95437ff544bb51dbc98fae12fd0d8d24285 (diff)
downloadservo-fad7df8e7ad317a2c4e33b7a02a0f9f3a479a1ee.tar.gz
servo-fad7df8e7ad317a2c4e33b7a02a0f9f3a479a1ee.zip
Simplify HTMLCollection predicates
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r--src/components/script/dom/htmldocument.rs23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs
index 50f2a7a0556..5cbb02b4b9b 100644
--- a/src/components/script/dom/htmldocument.rs
+++ b/src/components/script/dom/htmldocument.rs
@@ -80,15 +80,9 @@ impl HTMLDocument {
}
pub fn Links(&self) -> @mut HTMLCollection {
- self.createHTMLCollection(|elem| {
- if eq_slice(elem.tag_name, "a") || eq_slice(elem.tag_name, "area") {
- match elem.get_attr("href") {
- Some(_val) => true,
- None() => false
- }
- }
- else { false }
- })
+ self.createHTMLCollection(|elem|
+ (eq_slice(elem.tag_name, "a") || eq_slice(elem.tag_name, "area"))
+ && elem.get_attr("href").is_some())
}
pub fn Forms(&self) -> @mut HTMLCollection {
@@ -169,15 +163,8 @@ impl HTMLDocument {
}
pub fn Anchors(&self) -> @mut HTMLCollection {
- self.createHTMLCollection(|elem| {
- if eq_slice(elem.tag_name, "a") {
- match elem.get_attr("name") {
- Some(_val) => true,
- None() => false
- }
- }
- else { false }
- })
+ self.createHTMLCollection(|elem|
+ eq_slice(elem.tag_name, "a") && elem.get_attr("name").is_some())
}
pub fn Applets(&self) -> @mut HTMLCollection {