From bf9a19a71e3b2e91665a45ac285fd06869edc408 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 21 May 2012 22:07:40 +0200 Subject: [PATCH] use Ox.methods --- source/Ox.UI/js/Core/Ox.JQueryElement.js | 46 ++++++++++++------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.JQueryElement.js b/source/Ox.UI/js/Core/Ox.JQueryElement.js index c58b8751..2cf8fa6e 100644 --- a/source/Ox.UI/js/Core/Ox.JQueryElement.js +++ b/source/Ox.UI/js/Core/Ox.JQueryElement.js @@ -29,27 +29,25 @@ Ox.JQueryElement = function($element) { }; // add all jQuery functions to the prototype of Ox.JQueryElement -Ox.forEach($('
'), function(val, key) { - if (Ox.isFunction(val)) { - Ox.JQueryElement.prototype[key] = function() { - var args = arguments, id, ret, that = this; - Ox.forEach(args, function(arg, i) { - // FIXME: with the changes above, is this still needed? - // if an ox object was passed - // then pass its $element instead - // so that we can do oxObj.jqFn(oxObj) - if (arg && arg.ox) { - args[i] = arg.$element; - } - }); - ret = that.$element[key].apply(that.$element, args); - // if exactly one $element of an ox object was returned - // then return the ox object instead - // so that we can do oxObj.jqFn().oxFn() - return ret && ret.jquery - && ret.length == 1 - && Ox.UI.elements[id = ret.data('oxid')] - ? Ox.UI.elements[id] : ret; - }; - } -}, true); +Ox.methods($('
'), true).forEach(function(method) { + Ox.JQueryElement.prototype[method] = function() { + var args = arguments, id, ret, that = this; + Ox.forEach(args, function(arg, i) { + // FIXME: with the changes above, is this still needed? + // if an ox object was passed + // then pass its $element instead + // so that we can do oxObj.jqFn(oxObj) + if (arg && arg.ox) { + args[i] = arg.$element; + } + }); + ret = that.$element[method].apply(that.$element, args); + // if exactly one $element of an ox object was returned + // then return the ox object instead + // so that we can do oxObj.jqFn().oxFn() + return ret && ret.jquery + && ret.length == 1 + && Ox.UI.elements[id = ret.data('oxid')] + ? Ox.UI.elements[id] : ret; + }; +}); \ No newline at end of file