-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Element.innerHTML - add info trusted types #40423
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
base: main
Are you sure you want to change the base?
Conversation
@@ -79,15 +153,6 @@ document.documentElement.innerHTML = `<pre>${document.documentElement.innerHTML. | |||
)}</pre>`; | |||
``` | |||
|
|||
#### Operational details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting I guess. But it doesn't actually matter. If it did/does it should be in the description part.
Preview URLs External URLs (3)URL:
URL:
(comment last updated: 2025-07-21 07:07:10) |
24677d9
to
cfaddcf
Compare
FYI @lukewarlow @wbamberg - this is the trusted types update for All the examples use trustedHTML. This also shows the first live example use of the tinyfill in the docs. This is duplication with the main docs, but it feels very practical to me given the current state of trustedtypes. |
@@ -105,15 +119,35 @@ code { | |||
|
|||
#### JavaScript | |||
|
|||
```js hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to hide the tinyfill in this case. Do you think it should be here. Or perhaps a note "if trusted types not supported you should add a tinyfill".
This updates the following properties to explain how they are used with TrustedTypes:
Element.innerHTML
Element.insertAdjacentHTML()
This is in progress:
This does not mention the sanitizer methods as alternatives since the
setHTML()
is not implemented anywhere, and the sanitizer insetHTMLUnsafe()
is not yet implemented. We're in separate discussion on those and when they are in a release we can revisit.Part of #37518 (tracking issue)