LibWeb/SVG: Process script element when its text content changes

This commit is contained in:
Tim Ledbetter 2025-02-26 12:37:38 +00:00 committed by Jelle Raaijmakers
commit a187d5f28f
Notes: github-actions[bot] 2025-02-26 15:09:59 +00:00
6 changed files with 42 additions and 3 deletions

View file

@ -0,0 +1 @@
SVG script ran: true

View file

@ -2,10 +2,10 @@ Harness status: OK
Found 5 tests
4 Pass
1 Fail
3 Pass
2 Fail
Pass SVG scripts with end tag should run
Fail SVG scripts without end tag should not run
Pass SVG scripts with bogus end tag inside should run
Pass SVG scripts ended by HTML breakout should not run
Fail SVG scripts ended by HTML breakout should not run
Pass SVG scripts with self-closing start tag should run

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<div id="script-container"></div>
<script>
let scriptRan = false;
test(() => {
let script = document.createElementNS("http://www.w3.org/2000/svg", "script");
script.textContent = `scriptRan = true;`;
document.getElementById('script-container').appendChild(script);
println(`SVG script ran: ${scriptRan}`);
});
</script>