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

fix nthchild false negative #1757

Merged
merged 2 commits into from Nov 16, 2015

Conversation

Projects
None yet
2 participants
@mstrutt
Copy link
Contributor

mstrutt commented Nov 14, 2015

Passing a function in to Modernizr.addTest resulted the code being executed after elem had been removed from the DOM (and so had no layout). I've moved the code to be executed immediately and the just the result (which I renamed just to make the last line a bit more human readable) passed into Modernizr.addTest.

I searched the rest of the css feature-detects and nthchild appears to be the only test with this issue. That said, might be worth adding a little note to the docs about time of execution with testStyles and addTest.

All tests passed locally before and after this fix, but it was a bit beyond me to dive into what's happening with them

fixes #1675

var elems = elem.getElementsByTagName('div'),
test = true;
var elems = elem.getElementsByTagName('div'),
correctWidths = true;

This comment has been minimized.

@ryanseddon

ryanseddon Nov 15, 2015

Member

Can you change this to multiple var's this is an old one but all other tests should use this pattern going forward

@mstrutt

This comment has been minimized.

Copy link
Contributor Author

mstrutt commented Nov 15, 2015

done :)

ryanseddon added a commit that referenced this pull request Nov 16, 2015

Merge pull request #1757 from mstrutt/master
fix nthchild false negative

@ryanseddon ryanseddon merged commit b42ce72 into Modernizr:master Nov 16, 2015

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ryanseddon

This comment has been minimized.

Copy link
Member

ryanseddon commented Nov 16, 2015

Thanks @mstrutt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.