1
0
Fork 0
forked from 0x2620/oxjs

avoid leaks by adding custom empty/remove/replaceWith functions to Ox.Element

This commit is contained in:
rlx 2011-11-01 19:56:11 +00:00
commit 7848277593
4 changed files with 41 additions and 14 deletions

View file

@ -20,8 +20,9 @@ Ox.Focus = (function() {
blur: function(id) {
var index = stack.indexOf(id);
if (index > -1 && index == stack.length - 1) {
stack.length == 1 ? stack.pop() :
stack.splice(stack.length - 2, 0, stack.pop());
stack.length == 1
? stack.pop()
: stack.splice(stack.length - 2, 0, stack.pop());
//$elements[id].removeClass('OxFocus');
$('.OxFocus').removeClass('OxFocus'); // fixme: the above is better, and should work
stack.length && Ox.UI.elements[stack[stack.length - 1]].addClass('OxFocus');
@ -48,6 +49,10 @@ Ox.Focus = (function() {
@*/
focused: function() {
return stack.length ? stack[stack.length - 1] : null;
},
remove: function(id) {
var index = stack.indexOf(id);
index > -1 && stack.splice(index, 1);
}
};
}());