Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eleven-carpets-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: use TrustedHTML to test for customizable <select> support, where necessary
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { hydrating, reset, set_hydrate_node, set_hydrating } from '../hydration.js';
import { create_comment, create_element } from '../operations.js';
import { create_trusted_html } from '../reconciler.js';
import { attach } from './attachments.js';

/** @type {boolean | null} */
Expand All @@ -14,7 +15,7 @@ let supported = null;
function is_supported() {
if (supported === null) {
var select = create_element('select');
select.innerHTML = '<option><span>t</span></option>';
select.innerHTML = create_trusted_html('<option><span>t</span></option>');
supported = /** @type {Element} */ (select.firstChild)?.firstChild?.nodeType === 1;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/client/dom/reconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const policy =
});

/** @param {string} html */
function create_trusted_html(html) {
export function create_trusted_html(html) {
return /** @type {string} */ (policy?.createHTML(html) ?? html);
}

Expand Down
Loading