1
0
Fork 0
forked from 0x2620/oxjs

various documentation-related changes

This commit is contained in:
rolux 2011-05-05 20:02:56 +02:00
commit a6ed310087
13 changed files with 880 additions and 301 deletions

View file

@ -1,13 +1,20 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/***
Basic jQuery element
***/
/*@
Ox.JQueryElement <function> Wrapper for jQuery
# Usage
($element) -> <object> Wrapped jQuery DOM element
# Arguments
$element <object> jQuery DOM Element
@*/
Ox.JQueryElement = function($element) {
var that = this;
//@ Ox.JQueryElement.id <number> Unique id
that.id = Ox.uid();
//@ Ox.JQueryElement.ox <string> OxJS version
that.ox = Ox.VERSION;
//@ Ox.JQueryElement.$element <object> The jQuery DOM element
that.$element = $element.data({
oxid: that.id
});
@ -15,6 +22,7 @@ Ox.JQueryElement = function($element) {
return that;
};
// add all jQuery functions to the prototype of Ox.JQueryElement
Ox.forEach($('<div>'), function(val, key) {
if (Ox.isFunction(val)) {
Ox.JQueryElement.prototype[key] = function() {
@ -31,7 +39,7 @@ Ox.forEach($('<div>'), function(val, key) {
// if the $element of an ox object was returned
// then return the ox object instead
// so that we can do oxObj.jqFn().oxFn()
return ret.jquery && Ox.UI.elements[id = ret.data('oxid')] ?
return ret && ret.jquery && Ox.UI.elements[id = ret.data('oxid')] ?
Ox.UI.elements[id] : ret;
};
}