'use strict';

var ready = false,
	stack = [];

function completed() {
	if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
		if ( document.addEventListener ) {
			document.removeEventListener( 'DOMContentLoaded', completed, false );
			window.removeEventListener( 'load', completed, false );
		}
		else {
			document.detachEvent( "onreadystatechange", completed );
			window.detachEvent( "onload", completed );
		}

		var f;
		while ( f = stack.shift() ) {
			setTimeout( f, 0 );
		}

		ready = true;
	}
}

function domready( f ) {
	if ( typeof f != 'function' ) {
		return;
	}

	if ( ready || (document.readyState === 'complete' ) ) {
		setTimeout( f, 0 );
		return;
	}

	if ( stack.length <= 0 ) {
		if ( document.addEventListener ) {
			document.addEventListener( 'DOMContentLoaded', completed, false );
			window.addEventListener( 'load', completed, false );
		}
		else {
			document.attachEvent( "onreadystatechange", completed );
			window.attachEvent( "onload", completed );
		}
	}

	stack.push( f );
}

export default domready;

if ( typeof exports === 'object' ) {
	module.exports = domready;
}

@@ -574,24 +574,25 @@
 f ) %7B%0A%09if ( 
+(
 typeof f != 
@@ -601,16 +601,53 @@
 unction'
+) %7C%7C (typeof document == 'undefined')
  ) %7B%0A%09%09r

document check