From e6df18001ea0b8919b0dffa29b39670b3bc9a43e Mon Sep 17 00:00:00 2001 From: Rolux Date: Thu, 11 Feb 2010 00:12:59 +0530 Subject: [PATCH] misc. changes --- build/js/ox.ui.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 1d20a4ab..4bcb5c1b 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -772,33 +772,42 @@ requires // private function wrapjQuery() { - $.each(oxui.jQueryFunctions, function(i, v) { + $.each(oxui.jQueryFunctions, function(i, fn) { that[v] = function() { var args = arguments, length = args.length, - id, ret; - $.each(args, function(i, v) { + id, ret, $element; + $.each(args, function(i, arg) { // if an ox object was passed // then pass its $element instead // so we can do oxObj.jqFn(oxObj) - if (v.ox) { - args[i] = v.$element; + if (arg.ox) { + if (fn == "appendTo" && arg.$content) { + args[i] = v.$content + } else { + args[i] = v.$element; + } } }); + if (v == "html" && that.$content) { + $element = that.$content; + } else { + $element = that.$element; + } // why does this not work? // ret = that.$element[v].apply(this, arguments); if (length == 0) { - ret = that.$element[v](); + ret = $element[fn](); } else if (length == 1) { - ret = that.$element[v](args[0]); + ret = $element[fn](args[0]); } else if (length == 2) { - ret = that.$element[v](args[0], args[1]); + ret = $element[fn](args[0], args[1]); } else if (length == 3) { - ret = that.$element[v](args[0], args[1], args[2]); + ret = $element[fn](args[0], args[1], args[2]); } else if (length == 4) { - ret = that.$element[v](args[0], args[1], args[2], args[3]); + ret = $element[fn](args[0], args[1], args[2], args[3]); } - if (v == "data") { + if (fn == "data") { // Ox.print("data ret", ret, $(ret)) } // if the $element of an ox object was returned