<commit_before>/*
* jQuery Mobile Framework
* Copyright (c) jQuery Project
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change!!
	-	This file adds properties to $.support, 
*/

(function($,window,undefined){

	var $window = $(window),
		$html = $('html'),
		$head = $('head'),
		$body,
		$loader = $('<div class="ui-loader ui-body-c ui-corner-all fade in"><span class="ui-icon ui-icon-loading spin"></span><h1>loading.</h1></div>'),
		startPage,
		startPageId = 'ui-page-start',
		activePageClass = 'ui-page-active',
		transitions = 'slide slideup slidedown pop flip fade dissolve swap',
		transitionSpecified = false,
		currentTransition = 'slide',
		transitionDuration = 350,
		orientation,
		backBtnText = "Back",
		prevUrl = location.hash,
		//vars for custom event tracking
		scrolling = false,
		scrollListeningOn = true,
		touching = false,
		touchstartdata,
		touchstopdata,
		tapNotMoveTime = 75,
		tapHoldTime = 300,
		maxSwipeTime = 1000,
		minSwipeXDistance = 180,
		maxSwipeYtolerance = 80;
		
	/* 
		add some  properties to $.support
		- Notes: 
			- add $.support.scrollTop ?
			- CSS matrix support needed?
	*/
	$.support.orientation = !!window.orientation;
	
	//ajax support: to use bbq-style navigation with external pages, we will need to first test for ajax support (and fall back to normal urls)
	//note: maybe core should be updated with this support property?
	$.support.ajax = (function(){
		//factory test borrowed from quirksmode.org
        var xmlhttp = false, index = -1, factory,
            XMLHttpFactories = [
                function() { return new XMLHttpRequest() },
                function() { return new ActiveXObject("Msxml2.XMLHTTP") },
                function() { return new ActiveXObject("Msxml3.XMLHTTP") },
                function() { return new ActiveXObject("Microsoft.XMLHTTP") }
            ];
        while ((factory = XMLHttpFactories[++index])) {
            try { xmlhttp = factory(); }
            catch (e) { continue; }
            break;
        }
        return !!xmlhttp;
	})();

	/* Some CSS capability tests from EnhanceJS -- in the vein of $.support.boxmodel -- almost certainly needed for widgets to work
		* note: assuming they work in Firefox 4, these can run without domready (currently FF4 beta won't report these offset dimensions before body is present)
	*/
	//test CSS display none
	$.support.display = (function(){
		var fakeBody = $('<body></body>').prependTo($html),
			testDiv = $('<div style="height: 5px; position: absolute; display: none;"></div>').prependTo(fakeBody),
			divHeight = testDiv[0].offsetHeight; //note: jQuery .height() returned "5"
		fakeBody.remove();
		return divHeight === 0;
	})();	
		
	//test CSS absolute positioning
	$.support.position = (function(){	
		var fakeBody = $('<body></body>').prependTo($html),
			testDiv = $('<div style="position: absolute; left: 10px;"></div>').prependTo(fakeBody),
			divLeft = testDiv[0].offsetLeft;
        fakeBody.remove();
        return divLeft === 10;
    })();    
        
    //test CSS overflow (used in widgets for clearfix, hiding, etc)
    $.support.overflow = (function(){	
        var fakeBody = $('<body></body>').prependTo($html),
        	testDiv = $('<div style="position: absolute; overflow: hidden; height: 0;"><div style="height: 10px;"></div></div>').prependTo(fakeBody),
        	divHeight = testDiv[0].offsetHeight;
        fakeBody.remove();
        return divHeight === 0;
    })();
    
    //test CSS float,clear
    $.support.floatclear = (function(){
    	var fakeBody = $('<body></body>').prependTo($html),
    		pass = false,
    		innerStyle = 'style="width: 5px; height: 5px; float: left;"',
            testDiv = $('<div><div ' + innerStyle + '></div><div ' + innerStyle + '></div></div>').prependTo(fakeBody),
            kids = testDiv[0].childNodes,
            topA = kids[0].offsetTop,
            divB = kids[1],
            topB = divB.offsetTop;
        if (topA === topB) {
            divB.style.clear = 'left';
            topB = divB.offsetTop;
            if (topA !== topB) {
                pass = true;
            }
        }
        fakeBody.remove();
        return pass;
    })();
    
    //right about here, we *could* make sure all of the above css support props are true, if not, return and leave the page usable fercryin'outloud
	if(!$.support.display || !$.support.position || !$.support.overflow || !$.support.floatclear ) { return; }
	
	//support properties from jQtouch
	$.support.touch = (typeof Touch == "object");
    $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object");	
	
	/*
		add some core behavior,events
	*/	
	
	//test whether a CSS media type or query applies (adapted from work by <NAME> & <NAME>: http://gist.github.com/557891)
	$.media = (function(){
		if ( (window.media && media.matchMedium) ){
			//use native support if available
			return media.matchMedium;
		}
		var cache = {},
	        testDiv = $('<div id="jq-mediatest"></div>'),
	        fakeBody = $('<body></body>').append(testDiv);
	    return function(q){
	      if (cache[q] === undefined) {
	        var styleBlock = $('<style type="text/css"></style>');
	        var cssrule = '@media '+q+' { #jq-mediatest { position: absolute; } }';
	        if (styleBlock[0].styleSheet){ <commit_msg>commented out matchMedia logic for later<commit_after>/*
* jQuery Mobile Framework
* Copyright (c) jQuery Project
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change!!
	-	This file adds properties to $.support, 
*/

(function($,window,undefined){

	var $window = $(window),
		$html = $('html'),
		$head = $('head'),
		$body,
		$loader = $('<div class="ui-loader ui-body-c ui-corner-all fade in"><span class="ui-icon ui-icon-loading spin"></span><h1>loading.</h1></div>'),
		startPage,
		startPageId = 'ui-page-start',
		activePageClass = 'ui-page-active',
		transitions = 'slide slideup slidedown pop flip fade dissolve swap',
		transitionSpecified = false,
		currentTransition = 'slide',
		transitionDuration = 350,
		orientation,
		backBtnText = "Back",
		prevUrl = location.hash,
		//vars for custom event tracking
		scrolling = false,
		scrollListeningOn = true,
		touching = false,
		touchstartdata,
		touchstopdata,
		tapNotMoveTime = 75,
		tapHoldTime = 300,
		maxSwipeTime = 1000,
		minSwipeXDistance = 180,
		maxSwipeYtolerance = 80;
		
	/* 
		add some  properties to $.support
		- Notes: 
			- add $.support.scrollTop ?
			- CSS matrix support needed?
	*/
	$.support.orientation = !!window.orientation;
	
	//ajax support: to use bbq-style navigation with external pages, we will need to first test for ajax support (and fall back to normal urls)
	//note: maybe core should be updated with this support property?
	$.support.ajax = (function(){
		//factory test borrowed from quirksmode.org
        var xmlhttp = false, index = -1, factory,
            XMLHttpFactories = [
                function() { return new XMLHttpRequest() },
                function() { return new ActiveXObject("Msxml2.XMLHTTP") },
                function() { return new ActiveXObject("Msxml3.XMLHTTP") },
                function() { return new ActiveXObject("Microsoft.XMLHTTP") }
            ];
        while ((factory = XMLHttpFactories[++index])) {
            try { xmlhttp = factory(); }
            catch (e) { continue; }
            break;
        }
        return !!xmlhttp;
	})();

	/* Some CSS capability tests from EnhanceJS -- in the vein of $.support.boxmodel -- almost certainly needed for widgets to work
		* note: assuming they work in Firefox 4, these can run without domready (currently FF4 beta won't report these offset dimensions before body is present)
	*/
	//test CSS display none
	$.support.display = (function(){
		var fakeBody = $('<body></body>').prependTo($html),
			testDiv = $('<div style="height: 5px; position: absolute; display: none;"></div>').prependTo(fakeBody),
			divHeight = testDiv[0].offsetHeight; //note: jQuery .height() returned "5"
		fakeBody.remove();
		return divHeight === 0;
	})();	
		
	//test CSS absolute positioning
	$.support.position = (function(){	
		var fakeBody = $('<body></body>').prependTo($html),
			testDiv = $('<div style="position: absolute; left: 10px;"></div>').prependTo(fakeBody),
			divLeft = testDiv[0].offsetLeft;
        fakeBody.remove();
        return divLeft === 10;
    })();    
        
    //test CSS overflow (used in widgets for clearfix, hiding, etc)
    $.support.overflow = (function(){	
        var fakeBody = $('<body></body>').prependTo($html),
        	testDiv = $('<div style="position: absolute; overflow: hidden; height: 0;"><div style="height: 10px;"></div></div>').prependTo(fakeBody),
        	divHeight = testDiv[0].offsetHeight;
        fakeBody.remove();
        return divHeight === 0;
    })();
    
    //test CSS float,clear
    $.support.floatclear = (function(){
    	var fakeBody = $('<body></body>').prependTo($html),
    		pass = false,
    		innerStyle = 'style="width: 5px; height: 5px; float: left;"',
            testDiv = $('<div><div ' + innerStyle + '></div><div ' + innerStyle + '></div></div>').prependTo(fakeBody),
            kids = testDiv[0].childNodes,
            topA = kids[0].offsetTop,
            divB = kids[1],
            topB = divB.offsetTop;
        if (topA === topB) {
            divB.style.clear = 'left';
            topB = divB.offsetTop;
            if (topA !== topB) {
                pass = true;
            }
        }
        fakeBody.remove();
        return pass;
    })();
    
    //right about here, we *could* make sure all of the above css support props are true, if not, return and leave the page usable fercryin'outloud
	if(!$.support.display || !$.support.position || !$.support.overflow || !$.support.floatclear ) { return; }
	
	//support properties from jQtouch
	$.support.touch = (typeof Touch == "object");
    $.support.WebKitAnimationEvent = (typeof WebKitTransitionEvent == "object");	
	
	/*
		add some core behavior,events
	*/	
	
	//test whether a CSS media type or query applies (adapted from work by <NAME> & <NAME>: http://gist.github.com/557891)
	$.media = (function(){
		/*
		note: once support improves, try window.matchMedia here
		if ( window.matchMedia ){
			//use native support if available
			return window.matchMedia;
		}
		*/
		var cache = {},
	        testDiv = $('<div id="jq-mediatest"></div>'),
	        fakeBody = $('<body></body>').append(testDiv);
	    return function(q){
	      if (cache[q] === undefined) {
	        var styleBlock = $('<style type="text/css"></style>');
	        var cssrule = '@media '+q+' { #jq-mediatest { position: absolute; } }';
	        if (styleBlock[0].styleSheet){ 
{'fraction_non_alphanumeric': 0.1528380249192432, 'fraction_numerical': 0.009229349330872173, 'mean_word_length': 2.8576005695977216, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '724563', 'n_tokens_mistral': 3503, 'n_tokens_neox': 3210, 'n_words': 929}