valid.js 669 B

12345678910111213141516171819202122
  1. /*!
  2. {
  3. "name": "CSS :valid pseudo-class",
  4. "property": "cssvalid",
  5. "notes": [{
  6. "name": "MDN Docs",
  7. "href": "https://developer.mozilla.org/en-US/docs/Web/CSS/:valid"
  8. }]
  9. }
  10. !*/
  11. /* DOC
  12. Detects support for the ':valid' CSS pseudo-class.
  13. */
  14. define(['Modernizr', 'testStyles', 'createElement'], function(Modernizr, testStyles, createElement) {
  15. Modernizr.addTest('cssvalid', function() {
  16. return testStyles('#modernizr input{height:0;border:0;padding:0;margin:0;width:10px} #modernizr input:valid{width:50px}', function(elem) {
  17. var input = createElement('input');
  18. elem.appendChild(input);
  19. return input.clientWidth > 10;
  20. });
  21. });
  22. });