enhance-dev / enhance-dev/arc-plugin-enhance

Parser will extract script tags in script tags and bork the parent script

Open
#92 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Sounds wild, I know. And it's a bit of an edge case.
But if you have a script tag in an element definition, and then in that script tag you have a string that contains an open or close "", the parser gets eager to start extracting scripts.

Here's a sample `<my-element>` that will blow up in the browser -- server render works, or at least doesn't throw

```js
export default function ({ html }) {
return html`
<h1 class="text4 font-mono">my-element</h1>

<script>
console.log('start.')

// this string will trip up the parser
const someHTML2 = '<script>window.$$ = "$$";'

console.log('done.')

`
}
```

and here's a screenshot of what is rendered

![image](https://github.com/enhance-dev/arc-plugin-enhance/assets/15697/503238d2-054d-484b-aff2-c3e2e88c6df3)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.