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

Variable used before initialization #235

Closed
277hz opened this issue Jun 1, 2021 · 2 comments
Closed

Variable used before initialization #235

277hz opened this issue Jun 1, 2021 · 2 comments
Assignees

Comments

@277hz
Copy link

277hz commented Jun 1, 2021

d3-zoom/src/zoom.js

Lines 274 to 275 in 84a5e7b

p = pointer(event, currentTarget),
currentTarget = event.currentTarget,

While not generally an issue as d3-selection pointer resolves currentTarget by itself, event.currentTarget could technically change in between due to being a getter function.

Respective code was added by Fil/d3-zoom@3156eb0.

@Fil
Copy link
Member

Fil commented Jun 1, 2021

leaves me wondering if we should do

p = pointer(event), currentTarget = event.currentTarget,

or

currentTarget = event.currentTarget, p = pointer(event, currentTarget),

@Fil Fil self-assigned this Jun 1, 2021
@277hz
Copy link
Author

277hz commented Jun 1, 2021

@Fil I stumbled upon this while using some older obviously buggy version of Chrome.
Your second suggestion fixed it for me though.

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

No branches or pull requests

2 participants