Skip to content

Commit

Permalink
Merge pull request #26 from timse/master
Browse files Browse the repository at this point in the history
Changed the DOM-Ready to work in strict ECMA5
  • Loading branch information
eduardocereto committed Jul 9, 2012
2 parents 7fec147 + 0279dcb commit 43d8b29
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/helpers.js
Expand Up @@ -157,13 +157,14 @@ GasHelper.prototype._liveEvent = function(tag, evt, ofunc) {
*/
GasHelper.prototype._DOMReady = function(callback) {
var scp = this;
var cb = function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
callback.apply(scp, arguments);
};
if (/^(interactive|complete)/.test(document.readyState)) return cb();
this._addEventListener(document, 'DOMContentLoaded', cb, false);
this._addEventListener(window, 'load', cb, false);

function cb() {
if (cb.done) return;
cb.done = true;
callback.apply(scp, arguments);
}
};

0 comments on commit 43d8b29

Please sign in to comment.