Skip to content

Commit

Permalink
refactor: change style.innerHTML to style.textContent (#10801)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Nov 6, 2022
1 parent 96bd10a commit 8ea71b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ export function updateStyle(id: string, content: string): void {
style = document.createElement('style')
style.setAttribute('type', 'text/css')
style.setAttribute('data-vite-dev-id', id)
style.innerHTML = content
style.textContent = content
document.head.appendChild(style)
} else {
style.innerHTML = content
style.textContent = content
}
}
sheetsMap.set(id, style)
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
const style = `__vite_style__`
const injectCode =
`var ${style} = document.createElement('style');` +
`${style}.innerHTML = ${cssString};` +
`${style}.textContent = ${cssString};` +
`document.head.appendChild(${style});`
const wrapIdx = code.indexOf('System.register')
const insertMark = "'use strict';"
Expand Down

0 comments on commit 8ea71b4

Please sign in to comment.