Skip to content

Instantly share code, notes, and snippets.

@meyertee
Created November 2, 2011 10:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meyertee/1333330 to your computer and use it in GitHub Desktop.
Save meyertee/1333330 to your computer and use it in GitHub Desktop.
Modernizr Test 'nthchildn'
// Test for nth-child(...n) support
Modernizr.testStyles(" #modernizr div:nth-child(3n){width:10px;} ", function(elem, rule){
var bool = false, divs = elem.getElementsByTagName("div");
if (divs.length == 7){
var test = window.getComputedStyle ? function(i){
return getComputedStyle(divs[i], null)["width"] == "10px";
} : function(i){
return divs[i].currentStyle["width"] == "10px";
};
bool = !test(0) && !test(1) && test(2) && !test(3) && !test(4) && test(5) && !test(6);
}
Modernizr.addTest("nthchildn", bool);
}, 7);
@dbrai
Copy link

dbrai commented Dec 7, 2013

sxfdsff

@dbrai
Copy link

dbrai commented Dec 7, 2013

dfdfdfd

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