<commit_before>/**
 * module  web/domready
 * author  <NAME>
 */
 

// TODO!!!!!  complete event
 

;(function(K, undef){


/**
 * Custom domready event
 * @private
 * ----------------------------------------------------------------------------------------------------------- */

function domready(){

	// fire domready only once
	if(!is_domready){
		is_domready = true;
		fire_domready();
	}
}

function fire_domready(){
	var self = this,
		r = readyList, fn;
		
	if(r){	
		for(var i = 0, len = r.length; i < len; i ++){
			fn = r[i]
			fn && fn.call(WIN, K);
		}

		r.length = 0;
		readyList = null;
	}
};


function bind_domready(){
	is_domready_binded = true;

	var doc = WIN.document;
	
	// Catch cases where ready() is called after the
	// browser event has already occurred.
	if(doc.readyState === 'complete'){
		return setTimeout(domready, 0);
	}
	
	var doScroll = doc.documentElement.doScroll,
		eventType = doScroll ? 'readystatechange' : 'DOMContentLoaded',
		_doc = new DOM(doc),
		_win = new DOM(WIN),
		
		// define _ready function by variable assignment,
		// so _ready will never be declared if not necessary
		_ready = function(){
			_doc.off(eventType, _ready).
			_win.off('load', _ready);
			_doc = _win = null;
			domready();
		};
	
	_doc.on(eventType, _ready);
	
	// A fallback to load, binding load event to window,
	// and make sure that domready event fires before load event registered by user<commit_msg>dom/domready: fix a syntax error<commit_after>/**
 * module  web/domready
 * author  <NAME>
 */
 

// TODO!!!!!  complete event
 

;(function(K, undef){


/**
 * Custom domready event
 * @private
 * ----------------------------------------------------------------------------------------------------------- */

function domready(){

	// fire domready only once
	if(!is_domready){
		is_domready = true;
		fire_domready();
	}
}

function fire_domready(){
	var self = this,
		r = readyList, fn;
		
	if(r){	
		for(var i = 0, len = r.length; i < len; i ++){
			fn = r[i]
			fn && fn.call(WIN, K);
		}

		r.length = 0;
		readyList = null;
	}
};


function bind_domready(){
	is_domready_binded = true;

	var doc = WIN.document;
	
	// Catch cases where ready() is called after the
	// browser event has already occurred.
	if(doc.readyState === 'complete'){
		return setTimeout(domready, 0);
	}
	
	var doScroll = doc.documentElement.doScroll,
		eventType = doScroll ? 'readystatechange' : 'DOMContentLoaded',
		_doc = new DOM(doc),
		_win = new DOM(WIN),
		
		// define _ready function by variable assignment,
		// so _ready will never be declared if not necessary
		_ready = function(){
			_doc.off(eventType, _ready);
			_win.off('load', _ready);
			_doc = _win = null;
			domready();
		};
	
	_doc.on(eventType, _ready);
	
	// A fallback to load, binding load event to window,
	// and make sure that domready event fires before load event registered by user
{'fraction_non_alphanumeric': 0.20131898646303367, 'fraction_numerical': 0.0020826102047900035, 'mean_word_length': 2.3628938156359394, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4009016', 'n_tokens_mistral': 1021, 'n_tokens_neox': 914, 'n_words': 277}