fix for cases where passing an array of tooltips as an option to Ox.Button would cause Ox.Element to actually set the tooltip to that array

This commit is contained in:
rlx 2011-11-05 14:29:31 +00:00
commit 5a23d8936b
4 changed files with 18 additions and 9 deletions

View file

@ -42,7 +42,10 @@ Ox.Button = function(options, self) {
type: 'text',
width: 'auto'
})
.options(options || {})
.options(options ? Ox.extend(Ox.clone(options), {
// tooltip may be an array, so we can't pass it yet
tooltip: ''
}) : {})
.attr({
disabled: self.options.disabled,
type: self.options.type == 'text' ? 'button' : 'image'
@ -71,9 +74,8 @@ Ox.Button = function(options, self) {
setTitle(self.titles[self.selectedTitle].title);
if (self.options.tooltip) {
self.tooltips = Ox.isArray(self.options.tooltip)
? self.options.tooltip : [self.options.tooltip];
if (options.tooltip) {
self.tooltips = Ox.toArray(options.tooltip);
that.options({tooltip: self.tooltips[self.selectedTitle]});
}