Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(svg): apply generic presentation attributes
ldm0ccbf04f6fce3
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rsindex 3294d20f3..5d52d5f07 100644--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style.rs@@ -12363,6 +12363,53 @@ fn computed_style_resolves_valid_typed_css_math_and_rejects_invalid_unit_algebra);}+#[test]+fn svg_generic_presentation_attributes_apply_to_every_svg_element() {+ let mut vm = new_parsed_test_vm(+ "https://svg-generic-presentation-attributes.test/",+ r#"<!doctype html><svg id="svg"></svg>"#,+ );++ let result = vm+ .eval(+ r#"+(() => {+ const namespace = 'http://www.w3.org/2000/svg';+ const svg = document.getElementById('svg');+ const attributes = [+ ['font-size-adjust', '0.5'],+ ['text-overflow', 'ellipsis'],+ ['white-space', 'pre'],+ ];+ const values = [];++ for (const localName of ['text', 'rect', 'unknown']) {+ const element = document.createElementNS(namespace, localName);+ svg.append(element);+ const before = getComputedStyle(element);+ values.push(...attributes.map(([property]) => before.getPropertyValue(property)));+ for (const [attribute, value] of attributes)+ element.setAttribute(attribute, value);+ const after = getComputedStyle(element);+ values.push(...attributes.map(([property]) => after.getPropertyValue(property)));+ for (const [attribute] of attributes)+ element.removeAttribute(attribute);+ const removed = getComputedStyle(element);+ values.push(...attributes.map(([property]) => removed.getPropertyValue(property)));+ }++ return values.join('|');+})()+"#,+ )+ .expect("generic SVG presentation attributes should evaluate");++ assert_eq!(+ result,+ "none|clip|normal|0.5|ellipsis|pre|none|clip|normal|none|clip|normal|0.5|ellipsis|pre|none|clip|normal|none|clip|normal|0.5|ellipsis|pre|none|clip|normal"+ );+}+#[test]fn svg_special_presentation_attributes_follow_element_scopes_and_cascade() {let mut vm = new_parsed_test_vm(diff --git a/moli-selector/src/stylo/presentation.rs b/moli-selector/src/stylo/presentation.rsindex 6c31c571c..d91a15a86 100644--- a/moli-selector/src/stylo/presentation.rs+++ b/moli-selector/src/stylo/presentation.rs@@ -60,6 +60,7 @@ const SVG_STYLE_PRESENTATION_ATTRIBUTES: &[&str] = &["flood-opacity","font-family","font-size",+ "font-size-adjust","font-stretch","font-style","font-variant",@@ -89,11 +90,13 @@ const SVG_STYLE_PRESENTATION_ATTRIBUTES: &[&str] = &["stroke-width","text-anchor","text-decoration",+ "text-overflow","text-rendering","transform-origin","unicode-bidi","vector-effect","visibility",+ "white-space","word-spacing","writing-mode",];@@ -734,6 +737,9 @@ mod tests {"stroke-width","paint-order","shape-rendering",+ "font-size-adjust",+ "text-overflow",+ "white-space","width","height","x",