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::() - .expect("This should be an HTMLElement"); + let Some(elem) = node.downcast::() else { + // the style attribute only works on html elements + reply.send(None).unwrap(); + return; + }; let style = elem.Style(); let msg = (0..style.Length())