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

Refactor Van State to remove prototype to do reactive updates #198

Open
64BitAsura opened this issue Dec 20, 2023 · 1 comment
Open

Refactor Van State to remove prototype to do reactive updates #198

64BitAsura opened this issue Dec 20, 2023 · 1 comment

Comments

@64BitAsura
Copy link

As we know, we use proto to do expose synthetic properties like val and oldVal of the given state. But current browsers are depreciating usage of proto- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto

Screenshot 2023-12-20 180732

We should refactor to make this wonderful neat rendering technique update to do for modern browser baselines

@Tao-VanJS
Copy link
Member

Tao-VanJS commented Dec 20, 2023

Thanks for raising this interesting point! The __proto__ property is a tricky topic in JavaScript and understandably there are misunderstandings about it among developers. This is not the first time when people raised this issue.

On the other hand, after reading all the relevant docs, my conclusion is: the way that VanJS is doing with __proto__ is well supported by modern web-standard thus there is no concern on potentially losing support in future browser versions. In the same page you linked, please note that:

image

Also, see this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#prototype_setter for more clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants