Skip to content

Commit

Permalink
properly remove script tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbethel committed Jun 6, 2024
1 parent bae4d38 commit b7b5afb
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 b7b5afb

Please sign in to comment.