Skip to content

Improve usability of TrustedTypes API #175

Open

Description

@ditman

TrustedTypes definitions have landed, but please consider the following changes to the API to make it more usable:

  1. Make trustedTypes nullable, or provide a way to check if trustedTypes are available. TrustedTypes is a Chrome-only feature, and is undefined when not available. This is what I needed to do the last time I used TT:
  2. Also, it's needed for certain types to have setters that accept their TrustedType value, like: script.src and element.innerHtml (and have: script.trustedSrc and element.trustedInnerHtml...), for example:
  3. Also also, the second parameter to createScriptURL (and probably all other create functions) must be optional. I needed to override the method last time I used this:

/cc @kevmoo

TL;DR: Take this, fill in the gaps and make it part of package:web ppppplease :P

Activity

  1. self-assigned this
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions