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

Fixing a scoping issue with multiple Modernizr.on() callbacks for a single test #1016

Merged
merged 1 commit into from
Aug 13, 2013

Conversation

stucox
Copy link
Member

@stucox stucox commented Aug 13, 2013

There's a scoping issue in src/addTest.js:

If there are multiple callbacks for a test, the value of cb in this scope will be changed to the 2nd (then 3rd, then 4th etc) callback before the deferred function is executed even once – so the last callback gets executed multiple times, rather than each callback being called.

This PR fixes this.

+@SlexAxton

@SlexAxton
Copy link
Member

Nice catch.

SlexAxton added a commit that referenced this pull request Aug 13, 2013
Fixing a scoping issue with multiple `Modernizr.on()` callbacks for a single test
@SlexAxton SlexAxton merged commit 3eef42a into Modernizr:master Aug 13, 2013
@@ -35,14 +35,14 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function( Mo
var cb;
var i;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are those declarations now redundant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good spot. Fixed on master.

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this pull request Feb 22, 2015
Fixing a scoping issue with multiple `Modernizr.on()` callbacks for a single test
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

Successfully merging this pull request may close these issues.

None yet

3 participants