multiplebgs.js 841 B

12345678910111213141516171819202122
  1. /*!
  2. {
  3. "name": "CSS Multiple Backgrounds",
  4. "caniuse": "multibackgrounds",
  5. "property": "multiplebgs",
  6. "tags": ["css"]
  7. }
  8. !*/
  9. define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
  10. // Setting multiple images AND a color on the background shorthand property
  11. // and then querying the style.background property value for the number of
  12. // occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
  13. Modernizr.addTest('multiplebgs', function() {
  14. var style = createElement('a').style;
  15. style.cssText = 'background:url(https://),url(https://),red url(https://)';
  16. // If the UA supports multiple backgrounds, there should be three occurrences
  17. // of the string "url(" in the return value for elemStyle.background
  18. return (/(url\s*\(.*?){3}/).test(style.background);
  19. });
  20. });