mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Improve Option deconstruction
This commit is contained in:
parent
c70b88c163
commit
e3ae54dd5e
1 changed files with 4 additions and 3 deletions
|
@ -52,9 +52,10 @@ impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
|
||||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||||
let mut content = String::new();
|
let mut content = String::new();
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
if child.is_text() {
|
let text: Option<&JSRef<Text>> = TextCast::to_ref(&child);
|
||||||
let text: &JSRef<Text> = TextCast::to_ref(&child).unwrap();
|
match text {
|
||||||
content.push_str(text.deref().characterdata.data.deref().borrow().as_slice());
|
Some(text) => content.push_str(text.characterdata.data.borrow().as_slice()),
|
||||||
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
content
|
content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue