Skip to content
This repository
Browse code

Merge branch '3dtransform-test'

  • Loading branch information...
commit fe9250cdafbb781fe393787f33c7e0e85399b74c 2 parents 9318572 + 0590b47
Mat Marquis Wilto authored

Showing 1 changed file with 24 additions and 3 deletions. Show diff stats Hide diff stats

  1. +24 3 js/jquery.mobile.support.js
27 js/jquery.mobile.support.js
@@ -59,10 +59,31 @@ function validStyle( prop, value, check_vend ) {
59 59 return !!ret;
60 60 }
61 61
62   -// 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.
63 62 function transform3dTest() {
64   - var prop = "transform-3d";
65   - return validStyle( 'perspective', '10px', ['moz', ''] ) || $.mobile.media( "(-" + vendors.join( "-" + prop + "),(-" ) + "-" + prop + "),(" + prop + ")" );
  63 + var mqProp = "transform-3d",
  64 + ret = $.mobile.media( "(-" + vendors.join( "-" + mqProp + "),(-" ) + "-" + mqProp + "),(" + mqProp + ")" );
  65 +
  66 + if( ret ) {
  67 + return !!ret;
  68 + }
  69 +
  70 + var el = document.createElement( "div" ),
  71 + transforms = {
  72 + 'OTransform':'-o-transform',
  73 + 'msTransform':'-ms-transform',
  74 + 'MozTransform':'-moz-transform',
  75 + 'transform':'transform'
  76 + };
  77 +
  78 + fakeBody.append( el );
  79 +
  80 + for ( var t in transforms ) {
  81 + if( el.style[ t ] !== undefined ){
  82 + el.style[ t ] = 'translate3d( 100px, 1px, 1px )';
  83 + ret = window.getComputedStyle( el ).getPropertyValue( transforms[ t ] );
  84 + }
  85 + }
  86 + return ( !!ret && ret !== "none" );
66 87 }
67 88
68 89 // Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting )

0 comments on commit fe9250c

Please sign in to comment.
Something went wrong with that request. Please try again.