ignore set menu item fields

This commit is contained in:
Zeke Sikelianos 2016-03-17 16:20:23 -07:00
parent e9ba5abe03
commit 344dda4029

View file

@ -269,7 +269,7 @@ Menu.getApplicationMenu = function() {
Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder;
Menu.buildFromTemplate = function(template) {
var insertIndex, item, j, k, key, len, len1, menu, menuItem, positionedTemplate, value;
var insertIndex, item, j, k, key, len, len1, menu, menuItem, positionedTemplate;
if (!Array.isArray(template)) {
throw new TypeError('Invalid template for Menu');
}
@ -293,9 +293,9 @@ Menu.buildFromTemplate = function(template) {
}
menuItem = new MenuItem(item);
for (key in item) {
value = item[key];
if (menuItem[key] == null) {
menuItem[key] = value;
// Preserve extra fields specified by user
if (!menuItem.hasOwnProperty(key)) {
menuItem[key] = item[key];
}
}
menu.append(menuItem);