linkedom
linkedom copied to clipboard
`>` inside scripts get escaped.
> const { DOMParser } = require("linkedom");
undefined
> const parser = new DOMParser();
undefined
> parser.parseFromString(`<html><body><script>(() => {if (5>4) { console.log('hello') }})()</script></body></html>`).toString()
`<?xml version="1.0" encoding="utf-8"?><html><body><script>(() => {if (5>4) { console.log('hello') }})()</script></body></html>`
It should be () => { and 5>4
I'm using [email protected]
there are nodes where no escape should happen: title, textarea, and script or css, among others ... this keeps coming up and I've no idea why ... will have a look whenever I'll find time
I have a similar problem, but not sure if it's exactly the same. It's also about odd replacements in script tags:
const { document } = parseHTML(`<script>new RegExp('(^something.*$')</script>`)
console.log(document.toString());
prints:
<script>new RegExp('(^something.*/script>)</script>
If it's not the same issue, I'm happy to create a new one ✌️