mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Simplify iterating over Element attributes
This commit is contained in:
parent
81f094b129
commit
a7c470de09
1 changed files with 4 additions and 11 deletions
|
@ -17,7 +17,6 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||||
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||||
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
|
||||||
use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods;
|
|
||||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
|
@ -626,13 +625,9 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn summarize(&self) -> Vec<AttrInfo> {
|
pub fn summarize(&self) -> Vec<AttrInfo> {
|
||||||
let attrs = self.Attributes();
|
self.attrs.borrow().iter()
|
||||||
let mut summarized = vec!();
|
.map(|attr| attr.summarize())
|
||||||
for i in 0..attrs.Length() {
|
.collect()
|
||||||
let attr = attrs.Item(i).unwrap();
|
|
||||||
summarized.push(attr.summarize());
|
|
||||||
}
|
|
||||||
summarized
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_void(&self) -> bool {
|
pub fn is_void(&self) -> bool {
|
||||||
|
@ -785,9 +780,7 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
let attrs = element.Attributes();
|
for attr in element.attrs.borrow().iter() {
|
||||||
for i in 0..attrs.Length() {
|
|
||||||
let attr = attrs.Item(i).unwrap();
|
|
||||||
if *attr.prefix() == Some(atom!("xmlns")) &&
|
if *attr.prefix() == Some(atom!("xmlns")) &&
|
||||||
**attr.value() == *namespace.0 {
|
**attr.value() == *namespace.0 {
|
||||||
return Some(attr.LocalName());
|
return Some(attr.LocalName());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue