Visitar URL original
Add new update script trustedness algorithm for the HTML spec to call by lukewarlow · Pull Request #607 · w3c/trusted-types · GitHub
Skip to content

Add new update script trustedness algorithm for the HTML spec to call - #607

Merged
annevk merged 2 commits into
w3c:mainfrom
lukewarlow:upstream-script-idl
Oct 7, 2026
Merged

annevk merged 2 commits into
w3c:mainfrom
lukewarlow:upstream-script-idl

Conversation

@lukewarlow

@lukewarlow lukewarlow commented Feb 24, 2026 •

Copy link
Copy Markdown
Member

Move HTMLScriptElement IDL attribute patches into HTML

The HTMLScriptElement IDL changes and their getter and setter steps are being upstreamed into the HTML Standard in whatwg/html#12195. This removes the corresponding monkey patches for innerText, textContent, text and src.

In their place, this adds an exported "update script trustedness" algorithm. HTML's setters call it to update a script element's script text.

The HTML versions fix two spec-only mistakes in the removed text:

  • The text setter said "the given value" where it meant the compliant string.
  • The src getter relied on reflection internals that no longer apply once [ReflectURL] is removed.

Fixes #605


Preview | Diff

Remove script IDL changes as these are upstreamed
@lukewarlow
lukewarlow force-pushed the upstream-script-idl branch from 86daa66 to 75c926f Compare July 8, 2026 13:56

@annevk annevk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay once this has all landed. Would be good to include pointers in the commit message.

@lukewarlow

Copy link
Copy Markdown
Member Author

What pointers would you want in the commit message?

It's slightly tricky because this PR needs merging before the HTML one.

@annevk
annevk merged commit 3cd79cb into w3c:main Oct 7, 2026
3 checks passed
annevk pushed a commit to whatwg/html that referenced this pull request Oct 7, 2026
This upstreams the changes to `HTMLScriptElement`'s IDL attributes that were previously monkey patched by the Trusted Types specification, along with their getter and setter steps.

`HTMLScriptElement` now shadows `innerText` and `textContent` so they can take a `TrustedScript`. Its `src` and `text` IDL attributes now take `TrustedScriptURL` and `TrustedScript` respectively.

There are no behaviour changes. Spec-only mistakes in the Trusted Types text were fixed along the way:
  - The `text` setter said "the given value" where it meant the compliant string.
  - The `src` getter relied on reflection internals that no longer apply once `[ReflectURL]` is removed.

This depends on w3c/trusted-types#607 which adds the "update script trustedness" algorithm this calls and removes the corresponding monkey patches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTMLScriptElement doesn't show trusted types API in @webref/idl

2 participants