Skip to content

Commit

Permalink
Merge pull request #9 from enhance-dev/script-tag-bug
Browse files Browse the repository at this point in the history
properly remove script tags
  • Loading branch information
kristoferjoseph authored Jun 6, 2024
2 parents bae4d38 + b7b5afb commit 7ef0e20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const CustomElementMixin = (superclass) => class extends superclass {
// Removes script tags as they are already appended to the body by SSR
// TODO: If only added dynamically in the browser we need to insert the script tag after running the script transform on it. As well as handle deduplication.
el.querySelectorAll('script')
.forEach((tag) => { el.content.removeChild(tag) })
.forEach((tag) => { el.removeChild(tag) })
}

removeStyleTags(el) {
Expand Down
3 changes: 3 additions & 0 deletions test/diff-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ <h1>${heading}</h1>
<p>${heading}</p>
<a href="/foo/${heading}"></a>
<slot></slot>
<script>
console.log("Script should be removed")
<${'/script>'}
`
}

Expand Down

0 comments on commit 7ef0e20

Please sign in to comment.