Don't attempt to report style attribute for non-htmlelements to devtools (#35519)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-02-17 22:33:11 +01:00 committed by GitHub
parent f01d525852
commit 32f19c1eae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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())