Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MutationObservable and IntersectionObservable methods are not enumerable #1635

Open
OlaviSau opened this issue Dec 9, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@OlaviSau
Copy link
Contributor

OlaviSau commented Dec 9, 2024

Describe the bug
The methods of MutationObservable and IntersectionObservable are enumerable in browser implementations. This is used by zone.js to forward calls from the proxies created by zone.js

To Reproduce
Steps to reproduce the behavior:
MutationObserver.prototype.propertyIsEnumerable("observe") // => false

Expected behavior
MutationObserver.prototype.propertyIsEnumerable("observe") // => true

Device:
ALL

Additional context
Although I personally do not like this, I think those properties should be marked as enumerable. This can either be done by creating an utility decorator or by setting the property after the class has been created. This works in user land too, just have to set the values as enumerable before zone.js is ran.

Object.defineProperty(
	window.IntersectionObserver.prototype,
	"observe",
	{ enumerable: true, value: window.IntersectionObserver.prototype.observe },
);
@OlaviSau OlaviSau added the bug Something isn't working label Dec 9, 2024
@OlaviSau
Copy link
Contributor Author

OlaviSau commented Dec 9, 2024

@capricorn86 LMK if you want me to create PR + tests for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@OlaviSau and others