Replies: 1 comment
-
Just tested your snippet – I would also be surprised by the current behavior. To me it feels more like a bug than a feature. Changing it would be a breaking change, though. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Basically, when a child calls a method on the parent, the method's
this
is evaluated as the child's scope, not the parent where the method is defined.I feel this is an unintended behavior, as a child and parent should not need to be so aware of the others implementation details (a child can inadvertently overwrite an property in it's own scope and then the parent can stop functioning when the property is now not referring to the intended values.
example:
https://codepen.io/ekwoka/pen/mdGpKJW
While the method is the same, each bottom has a different behavior because of how the inner scope provides a new value in the property.
I'll look into fixing this, but it might be nice to see if anyone else agrees this is unintended (And thus a bug) or as an argument for why this behavior would be valuable as the default (I could see some use cases where it's helpful but those could be done simply if this was "fixed" and I think the cost of the behavior is a bigger issue)
Beta Was this translation helpful? Give feedback.
All reactions