checked.js 756 B

1234567891011121314151617181920212223
  1. /*!
  2. {
  3. "name": "CSS :checked pseudo-selector",
  4. "caniuse": "css-sel3",
  5. "property": "checked",
  6. "tags": ["css"],
  7. "notes": [{
  8. "name": "Related Github Issue",
  9. "href": "https://github.com/Modernizr/Modernizr/pull/879"
  10. }]
  11. }
  12. !*/
  13. define(['Modernizr', 'createElement', 'testStyles'], function(Modernizr, createElement, testStyles) {
  14. Modernizr.addTest('checked', function() {
  15. return testStyles('#modernizr {position:absolute} #modernizr input {margin-left:10px} #modernizr :checked {margin-left:20px;display:block}', function(elem) {
  16. var cb = createElement('input');
  17. cb.setAttribute('type', 'checkbox');
  18. cb.setAttribute('checked', 'checked');
  19. elem.appendChild(cb);
  20. return cb.offsetLeft === 20;
  21. });
  22. });
  23. });