Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moves fixed positioning blacklist to jquery.mobile.support.js

  • Loading branch information...
commit 34c091ee6b87f43de37696d36826d145b3dd3004 1 parent 3b40d03
@Wilto Wilto authored
Showing with 39 additions and 39 deletions.
  1. +38 −0 js/jquery.mobile.support.js
  2. +1 −39 js/widgets/fixedToolbar.js
View
38 js/jquery.mobile.support.js
@@ -167,6 +167,44 @@ $.mobile.ajaxBlacklist =
// Symbian webkits pre 7.3
nokiaLTE7_3;
+
+// Browser detection! Weeee, here we go...
+// Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
+// Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
+// Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
+// The following function serves to rule out some popular browsers with known fixed-positioning issues
+// This is a plugin option like any other, so feel free to improve or overwrite it
+$.mobile.fixedBlacklist = ( function() {
+ var w = window,
+ ua = navigator.userAgent,
+ platform = navigator.platform,
+ // Rendering engine is Webkit, and capture major version
+ wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
+ wkversion = !!wkmatch && wkmatch[ 1 ],
+ ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
+ ffversion = !!ffmatch && ffmatch[ 1 ],
+ operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
+ omversion = !!operammobilematch && operammobilematch[ 1 ];
+
+ if(
+ // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
+ ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
+ // Opera Mini
+ ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
+ ( operammobilematch && omversion < 7458 ) ||
+ //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
+ ( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
+ // Firefox Mobile before 6.0 -
+ ( ffversion && ffversion < 6 ) ||
+ // WebOS less than 3
+ ( "palmGetResource" in window && wkversion && wkversion < 534 ) ||
+ // MeeGo
+ ( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
+ return true;
+ }
+ return false;
+}() );
+
// Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices
// to render the stylesheets when they're referenced before this script, as we'd recommend doing.
// This simply reappends the CSS in place, which for some reason makes it apply
View
40 js/widgets/fixedToolbar.js
@@ -21,44 +21,6 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
hideDuringFocus: "input, textarea, select",
updatePagePadding: true,
trackPersistentToolbars: true,
-
- // Browser detection! Weeee, here we go...
- // Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
- // Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
- // Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
- // The following function serves to rule out some popular browsers with known fixed-positioning issues
- // This is a plugin option like any other, so feel free to improve or overwrite it
- supportBlacklist: function() {
- var w = window,
- ua = navigator.userAgent,
- platform = navigator.platform,
- // Rendering engine is Webkit, and capture major version
- wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
- wkversion = !!wkmatch && wkmatch[ 1 ],
- ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
- ffversion = !!ffmatch && ffmatch[ 1 ],
- operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
- omversion = !!operammobilematch && operammobilematch[ 1 ];
-
- if(
- // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
- ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
- // Opera Mini
- ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
- ( operammobilematch && omversion < 7458 ) ||
- //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
- ( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
- // Firefox Mobile before 6.0 -
- ( ffversion && ffversion < 6 ) ||
- // WebOS less than 3
- ( "palmGetResource" in window && wkversion && wkversion < 534 ) ||
- // MeeGo
- ( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
- return true;
- }
-
- return false;
- },
initSelector: ":jqmData(position='fixed')"
},
@@ -71,7 +33,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
$page = $el.closest( ".ui-page" );
// Feature detecting support for
- if ( o.supportBlacklist() ) {
+ if ( $.mobile.fixedBlacklist ) {
self.destroy();
return;
}

0 comments on commit 34c091e

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