aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index cbba69ad..cbb2c7b8 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -87,6 +87,19 @@ JQLite.prototype = {
})(this[0]);
},
+ ready: function(fn) {
+ var fired = false;
+
+ function trigger() {
+ if (fired) return;
+ fired = true;
+ fn();
+ }
+
+ this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9
+ jqLite(window).bind('load', trigger); // fallback to window.onload for others
+ },
+
bind: function(type, fn){
var self = this,
element = self[0],