UNPKG

modernizr

Version:

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

24 lines (23 loc) 761 B
/*! { "name": "CSS :checked pseudo-selector", "caniuse": "css-sel3", "property": "checked", "tags": ["css"], "notes": [{ "name": "Related Github Issue", "href": "https://github.com/Modernizr/Modernizr/pull/879" }] } !*/ define(['Modernizr', 'createElement', 'testStyles'], function( Modernizr, createElement, testStyles ) { Modernizr.addTest('checked', function(){ return testStyles('#modernizr {position:absolute} #modernizr input {margin-left:10px} #modernizr :checked {margin-left:20px;display:block}', function(elem, rule){ var cb = createElement('input'); cb.setAttribute("type", "checkbox"); cb.setAttribute("checked", "checked"); elem.appendChild(cb); return cb.offsetLeft === 20; }); }); });