Sha256: 223b9d5897179f8823cc4c203b34b9a30e34911094d76e2a32ed224dc6f2bf10
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
// Event.onDOMReady for Prototype // by Vivabit via Dean Edwards: // http://dean.edwards.name/weblog/2006/06/again/ Object.extend(Event, { _domReady : function() { if (arguments.callee.done) return; arguments.callee.done = true; if (this._timer) clearInterval(this._timer); this._readyCallbacks.each(function(f) { f() }); this._readyCallbacks = null; }, onDOMReady : function(f) { if (!this._readyCallbacks) { var domReady = this._domReady.bind(this); if (document.addEventListener) document.addEventListener("DOMContentLoaded", domReady, false); /*@cc_on @*/ /*@if (@_win32) document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); document.getElementById("__ie_onload").onreadystatechange = function() { if (this.readyState == "complete") domReady(); }; /*@end @*/ if (/WebKit/i.test(navigator.userAgent)) { this._timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) domReady(); }, 10); } Event.observe(window, 'load', domReady); Event._readyCallbacks = []; } Event._readyCallbacks.push(f); } });
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
packr-3.2.1 | test/assets/src/domready.js |
grimen-packr-3.1.2 | test/assets/src/domready.js |
packr-3.1.1 | test/assets/src/domready.js |