From afb03615c0b2475417081dcafc804587279ddc50 Mon Sep 17 00:00:00 2001 From: Chris Ruppel Date: Wed, 26 Sep 2012 23:27:26 -0500 Subject: [PATCH] more test fixes --- feature-detects/css-gradients.js | 12 ++++++++---- feature-detects/indexedDB.js | 2 +- feature-detects/touch.js | 3 ++- test/index.html | 3 --- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/feature-detects/css-gradients.js b/feature-detects/css-gradients.js index d53f80a974..0b0643cc31 100644 --- a/feature-detects/css-gradients.js +++ b/feature-detects/css-gradients.js @@ -13,12 +13,16 @@ Modernizr.addTest('cssgradients', function() { str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', str3 = 'linear-gradient(left top,#9f9, white);'; - setCss( + var css = // legacy webkit syntax (FIXME: remove when syntax not in use anymore) (str1 + '-webkit- '.split(' ').join(str2 + str1) + // standard syntax // trailing 'background-image:' - prefixes.join(str3 + str1)).slice(0, -str1.length) - ); + Modernizr._prefixes.join(str3 + str1)).slice(0, -str1.length); - return contains(mStyle.backgroundImage, 'gradient'); + var elem = document.createElement('div'); + var style = elem.style; + style.cssText = css; + + // IE6 returns undefined so cast to string + return ('' + style.backgroundImage).indexOf('gradient') > -1; }); diff --git a/feature-detects/indexedDB.js b/feature-detects/indexedDB.js index b3551f1f99..930c55ceb3 100644 --- a/feature-detects/indexedDB.js +++ b/feature-detects/indexedDB.js @@ -4,4 +4,4 @@ // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB // For speed, we don't test the legacy (and beta-only) indexedDB -Modernizr.addTest('indexedDB', Modernizr.testAllProps("indexedDB", window)); +Modernizr.addTest('indexedDB', !!Modernizr.prefixed("indexedDB", window)); diff --git a/feature-detects/touch.js b/feature-detects/touch.js index ecce868408..4565fa76b4 100644 --- a/feature-detects/touch.js +++ b/feature-detects/touch.js @@ -19,7 +19,8 @@ Modernizr.addTest('touch', function() { if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { bool = true; } else { - injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { + var query = ['@media (',Modernizr._prefixes.join('touch-enabled),('),'heartz',')','{#modernizr{top:9px;position:absolute}}'].join(''); + Modernizr.testStyles(query, function( node ) { bool = node.offsetTop === 9; }); } diff --git a/test/index.html b/test/index.html index 587f0c87e4..00bdcef251 100644 --- a/test/index.html +++ b/test/index.html @@ -33,8 +33,6 @@ - - @@ -43,7 +41,6 @@ -