diff --git a/.changeset/gorgeous-vans-sparkle.md b/.changeset/gorgeous-vans-sparkle.md new file mode 100644 index 0000000000..9df0360fe9 --- /dev/null +++ b/.changeset/gorgeous-vans-sparkle.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: add more robust check for `Element` prototype diff --git a/packages/svelte/src/internal/client/dom/elements/attributes.js b/packages/svelte/src/internal/client/dom/elements/attributes.js index 802d45153d..91aa1aee65 100644 --- a/packages/svelte/src/internal/client/dom/elements/attributes.js +++ b/packages/svelte/src/internal/client/dom/elements/attributes.js @@ -1,7 +1,6 @@ import { DEV } from 'esm-env'; import { hydrating } from '../hydration.js'; import { get_descriptors, get_prototype_of } from '../../../shared/utils.js'; -import { NAMESPACE_SVG } from '../../../../constants.js'; import { create_event, delegate } from './events.js'; import { add_form_reset_listener, autofocus } from './misc.js'; import * as w from '../../warnings.js'; @@ -318,9 +317,11 @@ function get_setters(element) { setters_cache.set(element.nodeName, (setters = [])); var descriptors; var proto = get_prototype_of(element); + var element_proto = Element.prototype; // Stop at Element, from there on there's only unnecessary setters we're not interested in - while (proto.constructor.name !== 'Element') { + // Do not use contructor.name here as that's unreliable in some browser environments + while (element_proto !== proto) { descriptors = get_descriptors(proto); for (var key in descriptors) {