1
0
Fork 0
forked from 0x2620/oxjs

some redesign for better garbage collection of elements

This commit is contained in:
j 2011-11-04 22:14:30 +00:00
commit 1d09d19423
17 changed files with 129 additions and 101 deletions

View file

@ -102,7 +102,7 @@ Ox.ArrayInput = function(options, self) {
Ox.Log('Form', 'remove', i);
['input', 'removeButton', 'addButton', 'element'].forEach(function(element) {
var key = '$' + element;
self[key][i].removeElement();
self[key][i].remove();
self[key].splice(i, 1);
});
self.$input.length == 1 && self.$removeButton[0].options({title: 'close'});

View file

@ -72,12 +72,9 @@ 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];
self.$tooltip = Ox.Tooltip({
title: self.tooltips[self.selectedTitle]
});
that.mouseenter(mouseenter)
.mouseleave(mouseleave);
self.tooltips = Ox.isArray(self.options.tooltip)
? self.options.tooltip : [self.options.tooltip];
that.options({tooltip: self.tooltips[self.selectedTitle]});
}
function click() {
@ -108,14 +105,6 @@ Ox.Button = function(options, self) {
}
}
function mouseenter(e) {
self.$tooltip.show(e.clientX, e.clientY);
}
function mouseleave() {
self.$tooltip.hide();
}
function setTitle(title) {
self.title = title;
if (self.options.type == 'image') {
@ -138,6 +127,8 @@ Ox.Button = function(options, self) {
that.toggleClass('OxSelected');
}
that.triggerEvent('change');
} else if (key == 'tooltip') {
} else if (key == 'title') {
setTitle(value);
} else if (key == 'width') {
@ -145,7 +136,7 @@ Ox.Button = function(options, self) {
width: (value - 14) + 'px'
});
}
}
};
/*@
toggleDisabled <f>
@ -180,7 +171,7 @@ Ox.Button = function(options, self) {
setTitle(self.titles[self.selectedTitle].title);
// fixme: if the tooltip is visible
// we also need to call show()
self.$tooltip && self.$tooltip.options({
that.$tooltip && that.$tooltip.options({
title: self.tooltips[self.selectedTitle]
});
return that;

View file

@ -123,7 +123,7 @@ Ox.Form = function(options, self) {
that.removeItem = function(pos) {
Ox.Log('Form', 'removeItem', pos);
self.$items[pos].removeElement();
self.$items[pos].remove();
self.options.items.splice(pos, 1);
self.$items.splice(pos, 1);
}

View file

@ -195,6 +195,12 @@ Ox.Select = function(options, self) {
self.$menu.getItem(id).options({disabled: false});
};
self.superRemove = that.remove;
that.remove = function() {
self.$menu.remove();
self.superRemove();
};
// FIXME: selected() _and_ selectItem() _and_ value() ???
/*@