Skip to content

Commit

Permalink
Merge pull request #527 from bastimeyer/master
Browse files Browse the repository at this point in the history
background-size:cover test returns wrong result in FF and Opera
  • Loading branch information
paulirish committed May 11, 2012
2 parents 1419cd3 + 20f11ef commit 82e474b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions feature-detects/css-backgroundsizecover.js
@@ -1,11 +1,9 @@

// developer.mozilla.org/en/CSS/background-size

Modernizr.testStyles(' #modernizr { background-size: cover; } ', function(elem, rule){

var bool = (window.getComputedStyle ?
getComputedStyle(elem, null) :
elem.currentStyle)['background-size'] == 'cover';

Modernizr.addTest('bgsizecover', bool);
Modernizr.testStyles( '#modernizr{background-size:cover}', function( elem ) {
var style = window.getComputedStyle
? window.getComputedStyle( elem, null )
: elem.currentStyle;
Modernizr.addTest( 'bgsizecover', style.backgroundSize == 'cover' );
});

0 comments on commit 82e474b

Please sign in to comment.