Permalink
Browse files

added domReady to submodules, hooked it up to xui.ready and x$.ready,…

… updated profiles and docs for it, fixes issue #31
  • Loading branch information...
1 parent b556d56 commit 158e1a8d42308f00f9b2935f71061e5da67197ce @filmaj filmaj committed Jul 24, 2011
Showing with 41 additions and 0 deletions.
  1. +3 −0 .gitmodules
  2. +1 −0 packages/domready
  3. +5 −0 spec/tests/core-tests.js
  4. +29 −0 src/js/event.js
  5. +1 −0 util/profiles/bb.js
  6. +1 −0 util/profiles/core.js
  7. +1 −0 util/profiles/ie.js
View
@@ -7,3 +7,6 @@
[submodule "packages/emile"]
path = packages/emile
url = http://github.com/madrobby/emile.git
+[submodule "packages/domready"]
+ path = packages/domready
+ url = https://github.com/ded/domready.git
Submodule domready added at 395afa
View
@@ -437,6 +437,11 @@ CoreTests.prototype.run = function () {
x = null;
}
});
+ test('xui object should have a "ready" function', function() {
+ expect(2);
+ equals(typeof x$.ready, "function", "x$ should have the 'ready' function");
+ equals(typeof xui.ready, "function", "xui should have the 'ready' function");
+ });
test('.on(event,function() { ... }) should bind anonymous function to selected element, and should be triggered by .fire(event) call', function () {
QUnit.stop();
expect(2);
View
@@ -200,6 +200,35 @@ xui.touch = (function () {
};
})();
+/**
+ ready
+ ----
+
+ Event handler for when the DOM is ready. Thank you [domready](http://www.github.com/ded/domready)!
+
+ ### syntax ###
+
+ x$.ready(handler);
+
+ ### arguments ###
+
+ - handler `Function` event handler to be attached to the "dom is ready" event.
+
+ ### example ###
+
+ x$.ready(function() {
+ alert('mah doms are ready');
+ });
+
+ xui.ready(function() {
+ console.log('ready, set, go!');
+ });
+
+*/
+xui.ready = function(handler) {
+ domReady(handler);
+}
+
// lifted from Prototype's (big P) event model
function _getEventID(element) {
if (element._xuiEventID) return element._xuiEventID;
View
@@ -10,6 +10,7 @@
"src/js/xhr",
"packages/emile/emile",
"packages/sizzle/sizzle",
+ "packages/domready/ready",
"src/footer"
]
}
View
@@ -9,6 +9,7 @@
"src/js/style",
"src/js/xhr",
"packages/emile/emile",
+ "packages/domready/ready",
"src/footer"
]
}
View
@@ -11,6 +11,7 @@
"packages/emile/emile",
"packages/sizzle/sizzle",
"packages/split/split",
+ "packages/domready/ready",
"src/footer"
]
}

0 comments on commit 158e1a8

Please sign in to comment.