mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
script: Simplify Node::collect_text_contents.
This commit is contained in:
parent
157ce33105
commit
2bbde04ccd
1 changed files with 2 additions and 3 deletions
|
@ -1792,9 +1792,8 @@ impl Node {
|
||||||
pub fn collect_text_contents<T: Iterator<Item=Root<Node>>>(iterator: T) -> DOMString {
|
pub fn collect_text_contents<T: Iterator<Item=Root<Node>>>(iterator: T) -> DOMString {
|
||||||
let mut content = String::new();
|
let mut content = String::new();
|
||||||
for node in iterator {
|
for node in iterator {
|
||||||
match node.downcast::<Text>() {
|
if let Some(ref text) = node.downcast::<Text>() {
|
||||||
Some(ref text) => content.push_str(&text.upcast::<CharacterData>().data()),
|
content.push_str(&text.upcast::<CharacterData>().data());
|
||||||
None => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DOMString::from(content)
|
DOMString::from(content)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue