fix: add more robust check for `Element` prototype (#13744)

fixes #13691
fixes #13414
fixes #13726
pull/13750/head
Simon H 2 months ago committed by GitHub
parent a08f063b37
commit 2efae794b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add more robust check for `Element` prototype

@ -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) {

Loading…
Cancel
Save