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
Merged

fix nthchild false negative #1757

merged 2 commits into from
Nov 16, 2015

Conversation

mstrutt
Copy link
Contributor

@mstrutt 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;
Copy link
Member

Choose a reason for hiding this comment

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

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

@mstrutt
Copy link
Contributor Author

mstrutt commented Nov 15, 2015

done :)

ryanseddon added a commit that referenced this pull request Nov 16, 2015
fix nthchild false negative
@ryanseddon ryanseddon merged commit b42ce72 into Modernizr:master Nov 16, 2015
@ryanseddon
Copy link
Member

Thanks @mstrutt

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.

nth-child false negative
2 participants