mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
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::UnionTypes::NodeOrString;
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
|
@ -626,13 +625,9 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn summarize(&self) -> Vec<AttrInfo> {
|
||||
let attrs = self.Attributes();
|
||||
let mut summarized = vec!();
|
||||
for i in 0..attrs.Length() {
|
||||
let attr = attrs.Item(i).unwrap();
|
||||
summarized.push(attr.summarize());
|
||||
}
|
||||
summarized
|
||||
self.attrs.borrow().iter()
|
||||
.map(|attr| attr.summarize())
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn is_void(&self) -> bool {
|
||||
|
@ -785,9 +780,7 @@ impl Element {
|
|||
}
|
||||
|
||||
// Step 2.
|
||||
let attrs = element.Attributes();
|
||||
for i in 0..attrs.Length() {
|
||||
let attr = attrs.Item(i).unwrap();
|
||||
for attr in element.attrs.borrow().iter() {
|
||||
if *attr.prefix() == Some(atom!("xmlns")) &&
|
||||
**attr.value() == *namespace.0 {
|
||||
return Some(attr.LocalName());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue