Skip to content

Instantly share code, notes, and snippets.

@reubenmoes
Created August 4, 2015 15:51
Show Gist options
  • Save reubenmoes/d074dacd05cd4d033924 to your computer and use it in GitHub Desktop.
Save reubenmoes/d074dacd05cd4d033924 to your computer and use it in GitHub Desktop.
Modernizr csschecked test
/*!
{
"name": "CSS checked",
"property": ":checked",
"authors": ["richarcher"],
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/845"
}]
}
!*/
Modernizr.addTest('csschecked', function () {
return Modernizr.testStyles("#modernizr input {margin-left:0px;} #modernizr input:checked {margin-left: 20px;}", function (elem) {
var chx = document.createElement('input');
chx.type = "checkbox";
chx.checked = "checked";
elem.appendChild(chx);
return elem.lastChild.offsetLeft >= 20;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment