-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move csstransforms3d to feature-detects/css-transforms3d.js
- Loading branch information
Showing
2 changed files
with
19 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters