don't throw errors in menu when accessing non-existing items
This commit is contained in:
parent
12622724ee
commit
314788dd24
2 changed files with 14 additions and 7 deletions
|
@ -26,7 +26,8 @@ Ox.Focus = (function() {
|
||||||
: stack.splice(stack.length - 2, 0, stack.pop());
|
: stack.splice(stack.length - 2, 0, stack.pop());
|
||||||
//$elements[id].removeClass('OxFocus');
|
//$elements[id].removeClass('OxFocus');
|
||||||
$('.OxFocus').removeClass('OxFocus'); // fixme: the above is better, and should work
|
$('.OxFocus').removeClass('OxFocus'); // fixme: the above is better, and should work
|
||||||
stack.length && Ox.UI.elements[stack[stack.length - 1]].addClass('OxFocus');
|
stack.length && Ox.UI.elements[stack[stack.length - 1]]
|
||||||
|
.addClass('OxFocus').triggerEvent('focus');
|
||||||
Ox.Log('Core', 'blur', id, stack);
|
Ox.Log('Core', 'blur', id, stack);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -41,7 +42,8 @@ Ox.Focus = (function() {
|
||||||
stack.push(id);
|
stack.push(id);
|
||||||
$('.OxFocus').removeClass('OxFocus'); // fixme: see above
|
$('.OxFocus').removeClass('OxFocus'); // fixme: see above
|
||||||
Ox.Log('Core', 'focus', id, stack);
|
Ox.Log('Core', 'focus', id, stack);
|
||||||
Ox.UI.elements[id].addClass('OxFocus');
|
Ox.UI.elements[id]
|
||||||
|
.addClass('OxFocus').triggerEvent('focus');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*@
|
/*@
|
||||||
|
|
|
@ -140,7 +140,8 @@ Ox.MainMenu = function(options, self) {
|
||||||
checkItem <f> checkItem
|
checkItem <f> checkItem
|
||||||
@*/
|
@*/
|
||||||
that.checkItem = function(id) {
|
that.checkItem = function(id) {
|
||||||
that.getItem(id).options({checked: true});
|
var item = that.getItem(id);
|
||||||
|
item && item.options({checked: true});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,7 +149,8 @@ Ox.MainMenu = function(options, self) {
|
||||||
disableItem <f> disableItem
|
disableItem <f> disableItem
|
||||||
@*/
|
@*/
|
||||||
that.disableItem = function(id) {
|
that.disableItem = function(id) {
|
||||||
that.getItem(id).options({disabled: true});
|
var item = that.getItem(id);
|
||||||
|
item && item.options({disabled: true});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,7 +158,8 @@ Ox.MainMenu = function(options, self) {
|
||||||
enableItem <f> enableItem
|
enableItem <f> enableItem
|
||||||
@*/
|
@*/
|
||||||
that.enableItem = function(id) {
|
that.enableItem = function(id) {
|
||||||
that.getItem(id).options({disabled: false});
|
var item = that.getItem(id);
|
||||||
|
item && item.options({disabled: false});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -229,7 +232,8 @@ Ox.MainMenu = function(options, self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setItemTitle = function(id, title) {
|
that.setItemTitle = function(id, title) {
|
||||||
that.getItem(id).options({title: title});
|
var item = that.getItem(id);
|
||||||
|
item && item.options({title: title});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -237,7 +241,8 @@ Ox.MainMenu = function(options, self) {
|
||||||
uncheckItem <f> uncheckItem
|
uncheckItem <f> uncheckItem
|
||||||
@*/
|
@*/
|
||||||
that.uncheckItem = function(id) {
|
that.uncheckItem = function(id) {
|
||||||
that.getItem(id).options({checked: false});
|
var item = that.getItem(id);
|
||||||
|
item && item.options({checked: false});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue