Improve Option deconstruction

This commit is contained in:
Chris Paris 2014-08-16 09:31:22 -10:00
parent c70b88c163
commit e3ae54dd5e

View file

@ -52,9 +52,10 @@ impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> {
let node: &JSRef<Node> = NodeCast::from_ref(self);
let mut content = String::new();
for child in node.children() {
if child.is_text() {
let text: &JSRef<Text> = TextCast::to_ref(&child).unwrap();
content.push_str(text.deref().characterdata.data.deref().borrow().as_slice());
let text: Option<&JSRef<Text>> = TextCast::to_ref(&child);
match text {
Some(text) => content.push_str(text.characterdata.data.borrow().as_slice()),
None => (),
}
}
content