Skip to content

Commit

Permalink
fix: replace innerHTML with textContent
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Jul 2, 2020
1 parent b95e532 commit c2063d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/metastream-remote-extension/src/first.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
mutationList.reduce((scripts, mutation) => {
if (mutation.type !== 'childList') return scripts
const inlineScripts = Array.from(mutation.addedNodes).filter(
node => node instanceof HTMLScriptElement && node.innerHTML.length > 0
node => node instanceof HTMLScriptElement && node.textContent.length > 0
)
return inlineScripts.length > 0 ? [...scripts, ...inlineScripts] : scripts
}, [])
Expand All @@ -124,8 +124,8 @@
const scripts = getAddedScripts(mutationsList)
for (let script of scripts) {
for (let snippet of scriptSnippets) {
if (script.innerHTML.includes(snippet.code)) {
script.innerHTML = script.innerHTML.split(snippet.code).join(snippet.replacement)
if (script.textContent.includes(snippet.code)) {
script.textContent = script.textContent.split(snippet.code).join(snippet.replacement)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/metastream-remote-extension/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ ${ignoredSelectors}:empty {

const visibleTagName = target instanceof HTMLVideoElement ? 'video' : 'iframe'
const style = document.createElement('style')
style.innerHTML = getFocusStyles(visibleTagName, playerSettings.theaterModeSelectors)
style.textContent = getFocusStyles(visibleTagName, playerSettings.theaterModeSelectors)
theaterModeStyle = style
document.head.appendChild(theaterModeStyle)
}
Expand Down

0 comments on commit c2063d1

Please sign in to comment.