diff --git a/source/Ox.UI/js/Window/Tooltip.js b/source/Ox.UI/js/Window/Tooltip.js index cc97447f..c6fc1e71 100644 --- a/source/Ox.UI/js/Window/Tooltip.js +++ b/source/Ox.UI/js/Window/Tooltip.js @@ -18,16 +18,26 @@ Ox.Tooltip = function(options, self) { .options(options || {}) .update({ title: function() { - that.html(self.options.title); + setTitle(); self.options.title === '' && that.detach(); } }) .addClass('OxTooltip') - .html(self.options.title); + [Ox.isString(self.options.title) ? 'html' : 'append']( + self.options.title + ); - self.options.animate && that.css({ - opacity: 0 - }); + self.options.animate && that.css({opacity: 0}); + + setTitle(); + + function setTitle() { + if (Ox.isString(self.options.title)) { + that.html(self.options.title); + } else { + that.empty().append(self.options.title); + } + } /*@ hide hide tooltip @@ -61,12 +71,12 @@ Ox.Tooltip = function(options, self) { var last = Ox.last(arguments), left, top, width, height; if (self.options.title) { - if (Ox.isObject(arguments[0])) { + if (arguments.length == 1) { self.x = arguments[0].clientX; self.y = arguments[0].clientY; } else { self.x = x; - self.y = y + self.y = y; } $('.OxTooltip').detach(); // fixme: don't use DOM that.appendTo(Ox.UI.$body);