/* Possible additions: scollTop CSS Matrix */ // test whether a CSS media type or query applies $.media = (function() { // TODO: use window.matchMedia once at least one UA implements it var cache = {}, $html = $( "html" ), testDiv = $( "
" ), fakeBody = $( "" ).append( testDiv ); return function( query ) { if ( !( query in cache ) ) { var styleBlock = $( "" ); $html.prepend( fakeBody ).prepend( styleBlock ); cache[ query ] = testDiv.css( "position" ) === "absolute"; fakeBody.add( styleBlock ).remove(); } return cache[ query ]; }; })(); var fakeBody = $( "" ).prependTo( "html" ), fbCSS = fakeBody[0].style, vendors = ['webkit','moz','o'], webos = window.palmGetResource || window.PalmServiceBridge, //only used to rule out scrollTop bb = window.blackberry; //only used to rule out box shadow, as it's filled opaque on BB //thx Modernizr function propExists( prop ){ var uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + ' ' + vendors.join(uc_prop + ' ') + uc_prop).split(' '); for(var v in props){ if( fbCSS[ v ] !== undefined ){ return true; } } }; //test for dynamic-updating base tag support (allows us to avoid href,src attr rewriting) function baseTagTest(){ var fauxBase = location.protocol + '//' + location.host + location.pathname + "ui-dir/", base = $("", {"href": fauxBase}).appendTo("head"), link = $( "" ).prependTo( fakeBody ), rebase = link[0].href; base.remove(); return rebase.indexOf(fauxBase) === 0; }; $.extend( $.support, { orientation: "orientation" in window, touch: "ontouchend" in document, WebKitAnimationEvent: typeof WebKitTransitionEvent === "object", pushState: !!history.pushState, mediaquery: $.media('only all'), cssPseudoElement: !!propExists('content'), boxShadow: !!propExists('boxShadow') && !bb, scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[0]) && !webos, dynamicBaseTag: baseTagTest() }); fakeBody.remove(); //for ruling out shadows via css if( !$.support.boxShadow ){ $('html').addClass('ui-mobile-nosupport-boxshadow'); }