test namespace style synchronization

This commit is contained in:
SGavrl
2026-08-03 15:36:52 +00:00
parent 1518ca2a70
commit 73fe8b91ae

View File

@@ -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>"#);