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/icy-otters-fall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: locate Rollup annontaion friendly to JS downgraders
5 changes: 4 additions & 1 deletion packages/svelte/src/internal/client/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export const STALE_REACTION = new (class StaleReactionError extends Error {
message = 'The reaction that called `getAbortSignal()` was re-run or destroyed';
})();

export const IS_XHTML = /* @__PURE__ */ globalThis.document?.contentType?.includes('xml') ?? false;
export const IS_XHTML =
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
!!globalThis.document?.contentType &&
/* @__PURE__ */ globalThis.document.contentType.includes('xml');
export const ELEMENT_NODE = 1;
export const TEXT_NODE = 3;
export const COMMENT_NODE = 8;
Expand Down
10 changes: 5 additions & 5 deletions packages/svelte/src/internal/client/dom/reconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import { create_element } from './operations.js';

const policy = /* @__PURE__ */ globalThis?.window?.trustedTypes?.createPolicy(
'svelte-trusted-html',
{
const policy =
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
globalThis?.window?.trustedTypes &&
/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {
/** @param {string} html */
createHTML: (html) => {
return html;
}
}
);
});

/** @param {string} html */
function create_trusted_html(html) {
Expand Down
Loading