Skip to content

issueReporter: Trusted Types compatibility: use DOM API for creating HTML elements instead of string concatenation. #104643

@annkamsk

Description

@annkamsk

This is the next step in resolving #103699. It aims to replace construction of HTML elements by string concatenation with DOM API calls in all of the simple cases (i.a. when the text content of the element is not rendered in any special way eg. with codicons).

For example:
Replace
this._domNode.innerHTML = ‘<span>no commands</span>’;
with

this._domNode.innerText = ‘’;
this._domNode.appendChild(createHTMLElement<HTMLSpanElement>(‘span’, ‘no commands’);

This is ~10% of all of the issues discovered with tsec.

+@koto @engelsdamien

Metadata

Metadata

Assignees

Labels

insiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions