From b61ff5d7fc89583449ea1b1fd481974cf28ebc92 Mon Sep 17 00:00:00 2001 From: Kyle Simpson Date: Mon, 25 Feb 2013 10:45:16 -0600 Subject: [PATCH 1/2] correcting so global context is proper surrounding `this` using same pattern as done in bonzo and other similar libs, making sure there's a proper `context` instead of just the bare `this`. --- ready.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ready.js b/ready.js index b5b85a4..31dd550 100644 --- a/ready.js +++ b/ready.js @@ -1,11 +1,11 @@ /*! * domready (c) Dustin Diaz 2012 - License MIT */ -!function (name, definition) { +!function (name, context, definition) { if (typeof module != 'undefined') module.exports = definition() else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) - else this[name] = definition() -}('domready', function (ready) { + else context[name] = definition() +}('domready', this, function (ready) { var fns = [], fn, f = false , doc = document @@ -51,4 +51,4 @@ function (fn) { loaded ? fn() : fns.push(fn) }) -}) \ No newline at end of file +}) From f4cf654c9c43856579b0a0dd446d363bbff3e21d Mon Sep 17 00:00:00 2001 From: Kyle Simpson Date: Mon, 25 Feb 2013 10:47:13 -0600 Subject: [PATCH 2/2] updating minified file as well. --- ready.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ready.min.js b/ready.min.js index e17d705..bbfc255 100644 --- a/ready.min.js +++ b/ready.min.js @@ -1,4 +1,4 @@ /*! * domready (c) Dustin Diaz 2012 - License MIT */ -!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("domready",function(a){function m(a){l=1;while(a=b.shift())a()}var b=[],c,d=!1,e=document,f=e.documentElement,g=f.doScroll,h="DOMContentLoaded",i="addEventListener",j="onreadystatechange",k="readyState",l=/^loade|c/.test(e[k]);return e[i]&&e[i](h,c=function(){e.removeEventListener(h,c,d),m()},d),g&&e.attachEvent(j,c=function(){/^c/.test(e[k])&&(e.detachEvent(j,c),m())}),a=g?function(c){self!=top?l?c():b.push(c):function(){try{f.doScroll("left")}catch(b){return setTimeout(function(){a(c)},50)}c()}()}:function(a){l?a():b.push(a)}}) \ No newline at end of file +!function(a,ctx,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):ctx[a]=b()}("domready",this,function(a){function m(a){l=1;while(a=b.shift())a()}var b=[],c,d=!1,e=document,f=e.documentElement,g=f.doScroll,h="DOMContentLoaded",i="addEventListener",j="onreadystatechange",k="readyState",l=/^loade|c/.test(e[k]);return e[i]&&e[i](h,c=function(){e.removeEventListener(h,c,d),m()},d),g&&e.attachEvent(j,c=function(){/^c/.test(e[k])&&(e.detachEvent(j,c),m())}),a=g?function(c){self!=top?l?c():b.push(c):function(){try{f.doScroll("left")}catch(b){return setTimeout(function(){a(c)},50)}c()}()}:function(a){l?a():b.push(a)}})