browsernizr
Version:
Modernizr wrapper for use with browserify
24 lines (20 loc) • 876 B
JavaScript
/*!
{
"name": "CSS Multiple Backgrounds",
"caniuse": "multibackgrounds",
"property": "multiplebgs",
"tags": ["css"]
}
!*/
var Modernizr = require('./../../lib/Modernizr.js');
var createElement = require('./../../lib/createElement.js');
// Setting multiple images AND a color on the background shorthand property
// and then querying the style.background property value for the number of
// occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
Modernizr.addTest('multiplebgs', function() {
var style = createElement('a').style;
style.cssText = 'background:url(https://),url(https://),red url(https://)';
// If the UA supports multiple backgrounds, there should be three occurrences
// of the string "url(" in the return value for elemStyle.background
return (/(url\s*\(.*?){3}/).test(style.background);
});