Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-display/display-contents-svg-tspan-child-display-changed.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Display: changing display on a display:contents tspan in SVG text</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg><text id="text"><tspan id="tspan" style="display:contents;color:green">Text</tspan></text></svg>
<script>
test(() => {
const text = document.getElementById("text");
const tspan = document.getElementById("tspan");
text.getNumberOfChars();
tspan.style.display = "inline";
text.getNumberOfChars();
tspan.style.display = "contents";
assert_greater_than_equal(text.getNumberOfChars(), 0);
}, "Toggling display between inline and contents on a tspan in SVG text should not crash");
</script>