Skip to content

Commit

Permalink
Move csstransforms3d to feature-detects/css-transforms3d.js
Browse files Browse the repository at this point in the history
  • Loading branch information
seutje committed Sep 21, 2012
1 parent b94cf67 commit 7348214
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
19 changes: 19 additions & 0 deletions feature-detects/css-transforms3d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Modernizr.addTest('csstransforms3d', function() {

var ret = !!Modernizr.testAllProps('perspective');

// Webkit's 3D transforms are passed off to the browser's own graphics renderer.
// It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
// some conditions. As a result, Webkit typically recognizes the syntax but
// will sometimes throw a false positive, thus we must do a more thorough check:
if ( ret && 'webkitPerspective' in document.documentElement.style ) {

// Webkit allows this media query to succeed only if the feature is enabled.
// `@media (transform-3d),(-webkit-transform-3d){ ... }`
Modernizr.testStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
ret = node.offsetLeft === 9 && node.offsetHeight === 3;
});
}
return ret;
});
20 changes: 0 additions & 20 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,26 +529,6 @@ window.Modernizr = (function( window, document, undefined ) {
};


tests['csstransforms3d'] = function() {

var ret = !!testPropsAll('perspective');

// Webkit's 3D transforms are passed off to the browser's own graphics renderer.
// It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
// some conditions. As a result, Webkit typically recognizes the syntax but
// will sometimes throw a false positive, thus we must do a more thorough check:
if ( ret && 'webkitPerspective' in docElement.style ) {

// Webkit allows this media query to succeed only if the feature is enabled.
// `@media (transform-3d),(-webkit-transform-3d){ ... }`
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
ret = node.offsetLeft === 9 && node.offsetHeight === 3;
});
}
return ret;
};


/*>>webforms*/
// input features and input types go directly onto the ret object, bypassing the tests loop.
// Hold this guy to execute in a moment.
Expand Down

0 comments on commit 7348214

Please sign in to comment.