Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change style.innerHTML to style.textContent #10801

Merged
merged 1 commit into from Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/client/client.ts
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
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