5 (function( $, undefined ) {
7 var fakeBody = $( "<body>" ).prependTo( "html" ),
8 fbCSS = fakeBody[ 0 ].style,
9 vendors = [ "Webkit", "Moz", "O" ],
10 webos = "palmGetResource" in window, //only used to rule out scrollTop
11 operamini = window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]",
12 bb = window.blackberry; //only used to rule out box shadow, as it's filled opaque on BB
15 function propExists( prop ) {
16 var uc_prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 ),
17 props = ( prop + " " + vendors.join( uc_prop + " " ) + uc_prop ).split( " " );
19 for ( var v in props ){
20 if ( fbCSS[ props[ v ] ] !== undefined ) {
26 // Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting )
27 function baseTagTest() {
28 var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/",
29 base = $( "head base" ),
35 base = fauxEle = $( "<base>", { "href": fauxBase }).appendTo( "head" );
37 href = base.attr( "href" );
40 link = $( "<a href='testurl' />" ).prependTo( fakeBody );
41 rebase = link[ 0 ].href;
42 base[ 0 ].href = href || location.pathname;
47 return rebase.indexOf( fauxBase ) === 0;
51 // non-UA-based IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683
52 // allows for inclusion of IE 6+, including Windows Mobile 7
53 $.mobile.browser = {};
54 $.mobile.browser.ie = (function() {
56 div = document.createElement( "div" ),
59 while ( div.innerHTML = "<!--[if gt IE " + ( ++v ) + "]><br><![endif]-->", a[ 0 ] );
61 return v > 4 ? v : !v;
65 $.extend( $.support, {
66 orientation: "orientation" in window && "onorientationchange" in window,
67 touch: "ontouchend" in document,
68 cssTransitions: "WebKitTransitionEvent" in window,
69 pushState: "pushState" in history && "replaceState" in history,
70 mediaquery: $.mobile.media( "only all" ),
71 cssPseudoElement: !!propExists( "content" ),
72 touchOverflow: !!propExists( "overflowScrolling" ),
73 boxShadow: !!propExists( "boxShadow" ) && !bb,
74 scrollTop: ( "pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ] ) && !webos && !operamini,
75 dynamicBaseTag: baseTagTest()
81 // $.mobile.ajaxBlacklist is used to override ajaxEnabled on platforms that have known conflicts with hash history updates (BB5, Symbian)
82 // or that generally work better browsing in regular http for full page refreshes (Opera Mini)
83 // Note: This detection below is used as a last resort.
84 // We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible
85 var nokiaLTE7_3 = (function(){
87 var ua = window.navigator.userAgent;
89 //The following is an attempt to match Nokia browsers that are running Symbian/s60, with webkit, version 7.3 or older
90 return ua.indexOf( "Nokia" ) > -1 &&
91 ( ua.indexOf( "Symbian/3" ) > -1 || ua.indexOf( "Series60/5" ) > -1 ) &&
92 ua.indexOf( "AppleWebKit" ) > -1 &&
93 ua.match( /(BrowserNG|NokiaBrowser)\/7\.[0-3]/ );
96 $.mobile.ajaxBlacklist =
97 // BlackBerry browsers, pre-webkit
98 window.blackberry && !window.WebKitPoint ||
101 // Symbian webkits pre 7.3
104 // Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices
105 // to render the stylesheets when they're referenced before this script, as we'd recommend doing.
106 // This simply reappends the CSS in place, which for some reason makes it apply
109 $( "head link[rel='stylesheet']" ).attr( "rel", "alternate stylesheet" ).attr( "rel", "stylesheet" );
113 // For ruling out shadows via css
114 if ( !$.support.boxShadow ) {
115 $( "html" ).addClass( "ui-mobile-nosupport-boxshadow" );