aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/devtools.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 7718486c14d..66e22fc7b4e 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -198,9 +198,11 @@ pub(crate) fn handle_get_attribute_style(
Some(found_node) => found_node,
};
- let elem = node
- .downcast::<HTMLElement>()
- .expect("This should be an HTMLElement");
+ let Some(elem) = node.downcast::<HTMLElement>() else {
+ // the style attribute only works on html elements
+ reply.send(None).unwrap();
+ return;
+ };
let style = elem.Style();
let msg = (0..style.Length())