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

can.compute | NaN -> NaN dispatches a change event #2128

Closed
rjgotten opened this issue Dec 9, 2015 · 1 comment
Closed

can.compute | NaN -> NaN dispatches a change event #2128

rjgotten opened this issue Dec 9, 2015 · 1 comment

Comments

@rjgotten
Copy link

rjgotten commented Dec 9, 2015

https://github.com/canjs/canjs/blob/master/compute/proto_compute.js#L384

Currently can.compute fails to take into account the fact that NaN !== NaN, which causes computes to dispatch change events when their computed value remains NaN,

@justinbmeyer justinbmeyer added this to the 2.3.7 milestone Dec 15, 2015
@justinbmeyer
Copy link
Contributor

@rjgotten This should be a pretty easy fix. Simply change the logic around:

https://github.com/canjs/canjs/blob/master/compute/proto_compute.js#L384

To check if isNaN(newVal) ? ! isNaN(oldVal) : newValue !== oldValue.

And add a test.

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

No branches or pull requests

3 participants