Skip to content

Commit

Permalink
fix: guard against customElements being unavailable in browser exte…
Browse files Browse the repository at this point in the history
…nsion contexts (#14933)

fixes #14739
  • Loading branch information
dummdidumm authored Jan 7, 2025
1 parent 34628b9 commit 08061c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-books-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: guard against `customElements` being unavailable in browser extension contexts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ export function set_custom_element_data(node, prop, value) {
// Don't compute setters for custom elements while they aren't registered yet,
// because during their upgrade/instantiation they might add more setters.
// Instead, fall back to a simple "an object, then set as property" heuristic.
setters_cache.has(node.nodeName) || customElements.get(node.tagName.toLowerCase())
setters_cache.has(node.nodeName) ||
// customElements may not be available in browser extension contexts
!customElements ||
customElements.get(node.tagName.toLowerCase())
? get_setters(node).includes(prop)
: value && typeof value === 'object'
) {
Expand Down

0 comments on commit 08061c8

Please sign in to comment.