Files
Donny/강동윤andGitHub de394e65ed fix(html/minifier): Preserve JSON script boundaries (#12080)
**Description:**

Preserve JSON `script` element boundaries during HTML minification.

The JSON serializer normalizes Unicode escapes, which can turn escaped
less-than signs into literal characters and change how the HTML parser
delimits the containing element. Re-escape less-than signs after
serialization so the minified document retains the same element
structure. Add fixture coverage for encoded element-like content.

**Related issue (if exists):**

None.

**Verification:**

- `cargo test -p swc_html_minifier`
- `cargo fmt --all`
- `cargo clippy --all --all-targets -- -D warnings`
2026-07-29 01:23:22 +00:00

8 lines
158 B
HTML

<!doctype html>
<script type="application/json">
{
"content": "\u003C\u002Fscript>\u003Cdiv>content\u003C\u002Fdiv>"
}
</script>
<p>after</p>