Skip to content

Commit

Permalink
added domReady to submodules, hooked it up to xui.ready and x$.ready,…
Browse files Browse the repository at this point in the history
… updated profiles and docs for it, fixes issue xuijs#31
  • Loading branch information
Fil Maj committed Jul 24, 2011
1 parent b556d56 commit 158e1a8
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions packages/domready
Submodule domready added at 395afa
5 changes: 5 additions & 0 deletions spec/tests/core-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 29 additions & 0 deletions src/js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions util/profiles/bb.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"src/js/xhr",
"packages/emile/emile",
"packages/sizzle/sizzle",
"packages/domready/ready",
"src/footer"
]
}
1 change: 1 addition & 0 deletions util/profiles/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"src/js/style",
"src/js/xhr",
"packages/emile/emile",
"packages/domready/ready",
"src/footer"
]
}
1 change: 1 addition & 0 deletions util/profiles/ie.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.