Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Adds test for unprefixed perspective property."
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilto committed Dec 3, 2012
1 parent 17ce0a7 commit 83a250f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 4 additions & 3 deletions css/structure/jquery.mobile.transition.turn.css
Expand Up @@ -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 {
Expand Down
16 changes: 10 additions & 6 deletions js/jquery.mobile.support.js
Expand Up @@ -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]",
Expand All @@ -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++ ) {
Expand All @@ -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 )
Expand Down

0 comments on commit 83a250f

Please sign in to comment.