Skip to content

Commit b7b5afb

Browse files
committed
properly remove script tags
1 parent bae4d38 commit b7b5afb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const CustomElementMixin = (superclass) => class extends superclass {
3535
// Removes script tags as they are already appended to the body by SSR
3636
// 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.
3737
el.querySelectorAll('script')
38-
.forEach((tag) => { el.content.removeChild(tag) })
38+
.forEach((tag) => { el.removeChild(tag) })
3939
}
4040

4141
removeStyleTags(el) {

test/diff-test.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ <h1>${heading}</h1>
8585
<p>${heading}</p>
8686
<a href="/foo/${heading}"></a>
8787
<slot></slot>
88+
<script>
89+
console.log("Script should be removed")
90+
<${'/script>'}
8891
`
8992
}
9093

0 commit comments

Comments
 (0)