The headless browser for AI agents and web scraping
test namespace style synchronization
SGavrl73fe8b91ae24
diff --git a/crates/obscura-js/src/runtime.rs b/crates/obscura-js/src/runtime.rsindex af068845..601ada30 100644--- a/crates/obscura-js/src/runtime.rs+++ b/crates/obscura-js/src/runtime.rs@@ -1442,6 +1442,17 @@ mod tests {assert_eq!(margin, serde_json::json!("5px"));}+ #[test]+ fn null_namespace_style_attribute_stays_in_sync() {+ let mut rt = setup_runtime(r#"<html><body><div id="d">hi</div></body></html>"#);+ let result = rt+ .evaluate(+ "(function(){var e=document.getElementById('d'); e.setAttributeNS(null,'style','color: green'); var before=e.style.color; e.removeAttributeNS(null,'style'); return before+'|'+e.style.color+'|'+String(e.getAttribute('style'));})()",+ )+ .unwrap();+ assert_eq!(result, serde_json::json!("green||null"));+ }+#[test]fn setting_style_property_updates_the_attribute_and_serialization() {let mut rt = setup_runtime(r#"<html><body><div id="d">hi</div></body></html>"#);