mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-22 15:14:44 +00:00
Updated and DRY’d transition/3D-transform support tests for Firefox.
This commit is contained in:
parent
e5d1b11328
commit
6e8fb254a6
1 changed files with 31 additions and 11 deletions
|
|
@ -27,14 +27,38 @@ function propExists( prop ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Thanks to Modernizr src for this test idea
|
||||
function validStyle( prop, value, check_vend ) {
|
||||
var div = document.createElement('div'),
|
||||
uc = function( txt ) {
|
||||
return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 )
|
||||
},
|
||||
vend_pref = function( vend ) {
|
||||
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 );
|
||||
|
||||
div.setAttribute( "style", vend_prop );
|
||||
|
||||
if( !!div.style[ propStyle ] ) {
|
||||
ret = true;
|
||||
}
|
||||
},
|
||||
check_vends = check_vend ? [ check_vend ] : vendors,
|
||||
ret;
|
||||
|
||||
for( i = 0; i < check_vends.length; i++ ) {
|
||||
check_style( check_vends[i] );
|
||||
}
|
||||
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.
|
||||
function transform3dTest() {
|
||||
var prop = "transform-3d";
|
||||
|
||||
fakeBody[ 0 ].setAttribute('style', '-moz-perspective: 100px');
|
||||
// Android 2.3 (at least) returns a positive for 3D-specific properties—`perspective`, `perspective-origin`, `backface-visibility`—necessitating the preceeding approach to pass FF10+.
|
||||
// We should continue to look at ways to include other platforms as 3D support improves. IE10, for example.
|
||||
return fakeBody[ 0 ].style.MozPerspective !== undefined || $.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 )
|
||||
|
|
@ -81,11 +105,7 @@ $.mobile.browser.ie = (function() {
|
|||
$.extend( $.support, {
|
||||
orientation: "orientation" in window && "onorientationchange" in window,
|
||||
touch: "ontouchend" in document,
|
||||
cssTransitions: "WebKitTransitionEvent" in window || (function() {
|
||||
var div = document.createElement( "div" );
|
||||
div.setAttribute('style', '-moz-transition: height 100ms linear');
|
||||
return !!div.style.MozTransition;
|
||||
})(),
|
||||
cssTransitions: "WebKitTransitionEvent" in window || validStyle( 'transition', 'height 100ms linear' ),
|
||||
pushState: "pushState" in history && "replaceState" in history,
|
||||
mediaquery: $.mobile.media( "only all" ),
|
||||
cssPseudoElement: !!propExists( "content" ),
|
||||
|
|
|
|||
Loading…
Reference in a new issue