Permalink
Browse files

Adds test for unprefixed `perspective` property."

  • Loading branch information...
1 parent 17ce0a7 commit 83a250f49d46d4623a232db18124cf3d5bc46852 @Wilto Wilto committed Dec 3, 2012
Showing with 14 additions and 9 deletions.
  1. +4 −3 css/structure/jquery.mobile.transition.turn.css
  2. +10 −6 js/jquery.mobile.support.js
@@ -6,9 +6,10 @@
*/
.viewport-turn {
- -webkit-perspective: 1000;
- -moz-perspective: 1000;
- perspective: 1000;
+ -webkit-perspective: 200px;
+ -moz-perspective: 200px;
+ -ms-perspective: 200px;
+ perspective: 200px;
position: absolute;
}
.turn {
@@ -20,7 +20,7 @@ function propExists( prop ) {
var fakeBody = $( "<body>" ).prependTo( "html" ),
fbCSS = fakeBody[ 0 ].style,
- vendors = [ "Webkit", "Moz", "O" ],
+ vendors = [ "Webkit", "Moz", "O", "ms", "" ],
webos = "palmGetResource" in window, //only used to rule out scrollTop
opera = window.opera,
operamini = window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]",
@@ -33,20 +33,24 @@ function validStyle( prop, value, check_vend ) {
return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 );
},
vend_pref = function( vend ) {
- return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-";
+ if( vend === "" ) {
+ return "";
+ } else {
+ return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-";
+ }
},
check_style = function( vend ) {
var vend_prop = vend_pref( vend ) + prop + ": " + value + ";",
uc_vend = uc( vend ),
- propStyle = uc_vend + uc( prop );
+ propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) );
div.setAttribute( "style", vend_prop );
if ( !!div.style[ propStyle ] ) {
ret = true;
}
},
- check_vends = check_vend ? [ check_vend ] : vendors,
+ check_vends = check_vend ? check_vend : vendors,
ret;
for( var i = 0; i < check_vends.length; i++ ) {
@@ -55,10 +59,10 @@ function validStyle( prop, value, check_vend ) {
return !!ret;
}
-// Thanks to Modernizr src for this test idea. `perspective` check is limited to Moz to prevent a false positive for 3D transforms on Android.
+// Thanks to Modernizr src for this test idea. `perspective` check is limited to Moz/unprefixed to prevent a false positive for 3D transforms on Android.
function transform3dTest() {
var prop = "transform-3d";
- return validStyle( 'perspective', '10px', 'moz' ) || $.mobile.media( "(-" + vendors.join( "-" + prop + "),(-" ) + "-" + prop + "),(" + prop + ")" );
+ return validStyle( 'perspective', '10px', ['moz', ''] ) || $.mobile.media( "(-" + vendors.join( "-" + prop + "),(-" ) + "-" + prop + "),(" + prop + ")" );
}
// Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting )

0 comments on commit 83a250f

Please sign in to comment.