Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 34c091ee6b87f43de37696d36826d145b3dd3004 1 parent 3b40d03
Mat Marquis authored September 07, 2012
38  js/jquery.mobile.support.js
@@ -167,6 +167,44 @@ $.mobile.ajaxBlacklist =
167 167
 			// Symbian webkits pre 7.3
168 168
 			nokiaLTE7_3;
169 169
 
  170
+
  171
+// Browser detection! Weeee, here we go...
  172
+// Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
  173
+// Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
  174
+// Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
  175
+// The following function serves to rule out some popular browsers with known fixed-positioning issues
  176
+// This is a plugin option like any other, so feel free to improve or overwrite it
  177
+$.mobile.fixedBlacklist = ( function() {
  178
+	var w = window,
  179
+		ua = navigator.userAgent,
  180
+		platform = navigator.platform,
  181
+		// Rendering engine is Webkit, and capture major version
  182
+		wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
  183
+		wkversion = !!wkmatch && wkmatch[ 1 ],
  184
+		ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
  185
+		ffversion = !!ffmatch && ffmatch[ 1 ],
  186
+		operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
  187
+		omversion = !!operammobilematch && operammobilematch[ 1 ];
  188
+
  189
+	if(
  190
+		// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
  191
+		( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1  || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
  192
+		// Opera Mini
  193
+		( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
  194
+		( operammobilematch && omversion < 7458 )	||
  195
+		//Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
  196
+		( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
  197
+		// Firefox Mobile before 6.0 -
  198
+		( ffversion && ffversion < 6 ) ||
  199
+		// WebOS less than 3
  200
+		( "palmGetResource" in window && wkversion && wkversion < 534 )	||
  201
+		// MeeGo
  202
+		( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
  203
+		return true;
  204
+	}
  205
+	return false;
  206
+}() );
  207
+
170 208
 // Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices
171 209
 // to render the stylesheets when they're referenced before this script, as we'd recommend doing.
172 210
 // This simply reappends the CSS in place, which for some reason makes it apply
40  js/widgets/fixedToolbar.js
@@ -21,44 +21,6 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
21 21
 			hideDuringFocus: "input, textarea, select",
22 22
 			updatePagePadding: true,
23 23
 			trackPersistentToolbars: true,
24  
-
25  
-			// Browser detection! Weeee, here we go...
26  
-			// Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
27  
-			// Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
28  
-			// Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
29  
-			// The following function serves to rule out some popular browsers with known fixed-positioning issues
30  
-			// This is a plugin option like any other, so feel free to improve or overwrite it
31  
-			supportBlacklist: function() {
32  
-				var w = window,
33  
-					ua = navigator.userAgent,
34  
-					platform = navigator.platform,
35  
-					// Rendering engine is Webkit, and capture major version
36  
-					wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
37  
-					wkversion = !!wkmatch && wkmatch[ 1 ],
38  
-					ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
39  
-					ffversion = !!ffmatch && ffmatch[ 1 ],
40  
-					operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
41  
-					omversion = !!operammobilematch && operammobilematch[ 1 ];
42  
-
43  
-				if(
44  
-					// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
45  
-					( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1  || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
46  
-					// Opera Mini
47  
-					( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
48  
-					( operammobilematch && omversion < 7458 )	||
49  
-					//Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
50  
-					( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
51  
-					// Firefox Mobile before 6.0 -
52  
-					( ffversion && ffversion < 6 ) ||
53  
-					// WebOS less than 3
54  
-					( "palmGetResource" in window && wkversion && wkversion < 534 )	||
55  
-					// MeeGo
56  
-					( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
57  
-					return true;
58  
-				}
59  
-
60  
-				return false;
61  
-			},
62 24
 			initSelector: ":jqmData(position='fixed')"
63 25
 		},
64 26
 
@@ -71,7 +33,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
71 33
 				$page = $el.closest( ".ui-page" );
72 34
 
73 35
 			// Feature detecting support for
74  
-			if ( o.supportBlacklist() ) {
  36
+			if ( $.mobile.fixedBlacklist ) {
75 37
 				self.destroy();
76 38
 				return;
77 39
 			}

0 notes on commit 34c091e

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