Skip to content

Fix Trusted Types violation (round #1) #106285

@jrieken

Description

@jrieken

This is part of the TrustedTypes effort (see #103699) and a list of innerHTML usages which we avoid. To compile a list of violations

  • run yarn web --trusted-types
  • open http://localhost:8080/ in Edge or Chrome
  • open console and check for "[Report Only] This document requires 'TrustedHTML' assignment."-messages

Also, there is .vscode/searches/TrustedTypes.code-search which finds all occurences of innerHTML. There are common sources of violation and therefore common fixes

  • styling via style.innerHTML ➡️ use textContent instead (example c112f84)
  • clear a node via node.innerHTML = '' ➡️ use dom.ts#clearNode or node.innerText = ''
  • building dom nodes ➡️ use dom.$ or document.createElement and friends

Metadata

Metadata

Assignees

Labels

debtCode quality issuesengineeringVS Code - Build / issue tracking / etc.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions