Skip to content

Commit

Permalink
fix: add more robust check for Element prototype (#13744)
Browse files Browse the repository at this point in the history
fixes #13691
fixes #13414
fixes #13726
  • Loading branch information
dummdidumm authored Oct 21, 2024
1 parent a08f063 commit 2efae79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-vans-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: add more robust check for `Element` prototype
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2efae79

Please sign in to comment.