modernizr
Version:
Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
36 lines (31 loc) • 1.01 kB
JavaScript
/*!
{
"name": "Background Repeat",
"property": ["bgrepeatspace", "bgrepeatround"],
"tags": ["css"],
"authors": ["Ryan Seddon"],
"notes": [{
"name": "MDN Docs",
"href": "http://developer.mozilla.org/en/CSS/background-repeat"
}, {
"name": "Test Page",
"href": "http://jsbin.com/uzesun/"
}, {
"name": "Demo",
"href": "http://jsfiddle.net/ryanseddon/yMLTQ/6/"
}]
}
!*/
define(['Modernizr', 'testStyles'], function( Modernizr, testStyles ) {
function getBgRepeatValue( elem ) {
return (window.getComputedStyle ?
getComputedStyle(elem, null).getPropertyValue('background') :
elem.currentStyle['background']);
}
testStyles(' #modernizr { background-repeat: round; } ', function( elem, rule ) {
Modernizr.addTest('bgrepeatround', getBgRepeatValue(elem) == 'round');
});
testStyles(' #modernizr { background-repeat: space; } ', function( elem, rule ) {
Modernizr.addTest('bgrepeatspace', getBgRepeatValue(elem) == 'space');
});
});