Skip to content

Commit 2efae79

Browse files
authored
fix: add more robust check for Element prototype (#13744)
fixes #13691 fixes #13414 fixes #13726
1 parent a08f063 commit 2efae79

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/gorgeous-vans-sparkle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: add more robust check for `Element` prototype

packages/svelte/src/internal/client/dom/elements/attributes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { DEV } from 'esm-env';
22
import { hydrating } from '../hydration.js';
33
import { get_descriptors, get_prototype_of } from '../../../shared/utils.js';
4-
import { NAMESPACE_SVG } from '../../../../constants.js';
54
import { create_event, delegate } from './events.js';
65
import { add_form_reset_listener, autofocus } from './misc.js';
76
import * as w from '../../warnings.js';
@@ -318,9 +317,11 @@ function get_setters(element) {
318317
setters_cache.set(element.nodeName, (setters = []));
319318
var descriptors;
320319
var proto = get_prototype_of(element);
320+
var element_proto = Element.prototype;
321321

322322
// Stop at Element, from there on there's only unnecessary setters we're not interested in
323-
while (proto.constructor.name !== 'Element') {
323+
// Do not use contructor.name here as that's unreliable in some browser environments
324+
while (element_proto !== proto) {
324325
descriptors = get_descriptors(proto);
325326

326327
for (var key in descriptors) {

0 commit comments

Comments
 (0)