feat: support TrustedHTML in {@html} expressions#17701
Conversation
🦋 Changeset detectedLatest commit: 981156b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
Btw, I believe these lines need trustifiing as well svelte/packages/svelte/src/internal/client/dom/template.js Lines 288 to 292 in 220b526 Edit: also, guess |
|
Ah yep good catch. Those should probably go in a separate PR since it's separate to the |
dummdidumm
left a comment
There was a problem hiding this comment.
code looks good. Is this referencing any issue or PR? Description references none
|
ah yep, is a follow-up to #16271. Have updated the PR description |
|
opened #17743 for #17701 (comment). Assigning |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## svelte@5.52.0 ### Minor Changes - feat: support TrustedHTML in `{@html}` expressions ([#17701](#17701)) ### Patch Changes - fix: repair dynamic component truthy/falsy hydration mismatches ([#17737](#17737)) - fix: re-run non-render-bound deriveds on the server ([#17674](#17674)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… necessary (#17743) #17701 (comment) no test because jsdom
Seems it requires in case of |
Follow-up to #16271.
Summary
{@html}blocks to acceptTrustedHTMLobjects (from TrustedTypes policies) without coercing them to strings{@html myPolicy.createHTML(someHTML)}Changes
html.js: Instead of callingcreate_fragment_from_html, create the wrapper element directly (<template>,<svg>, or<math>depending on context) and assign the value toinnerHTML. This preservesTrustedHTMLobjects.reconciler.js: Removed thetrustedparameter fromcreate_fragment_from_htmlsince it's no longer used by{@html}and all remaining callers want trusted HTML.template.jsandsnippet.js: Removed the second argument fromcreate_fragment_from_htmlcalls.Notes
No tests added because JSDOM doesn't implement TrustedTypes.