Skip to content

Commit c2c3177

Browse files
committed
avoid innerHTML in context view, #106395
1 parent 04b9275 commit c2c3177

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/vs/base/browser/ui/contextview/contextview.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,9 @@ export class ContextView extends Disposable {
157157
this.shadowRootHostElement = DOM.$('.shadow-root-host');
158158
this.container.appendChild(this.shadowRootHostElement);
159159
this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: 'open' });
160-
this.shadowRoot.innerHTML = `
161-
<style>
162-
${SHADOW_ROOT_CSS}
163-
</style>
164-
`;
160+
const style = document.createElement('style');
161+
style.textContent = SHADOW_ROOT_CSS;
162+
this.shadowRoot.appendChild(style);
165163
this.shadowRoot.appendChild(this.view);
166164
this.shadowRoot.appendChild(DOM.$('slot'));
167165
} else {

0 commit comments

Comments
 (0)