From 6ae198a6253fdf2321a280ea4b7ac582e69979cc Mon Sep 17 00:00:00 2001 From: mst128256 Date: Wed, 29 Mar 2017 12:17:50 +0200 Subject: [PATCH] Empty objects within default menu replaced by nulls --- lib/browser/api/menu-item-roles.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/browser/api/menu-item-roles.js b/lib/browser/api/menu-item-roles.js index b843bb82e8..30ea3f888d 100644 --- a/lib/browser/api/menu-item-roles.js +++ b/lib/browser/api/menu-item-roles.js @@ -180,7 +180,7 @@ const roles = { process.platform === 'darwin' ? { role: 'pasteandmatchstyle' - } : {}, + } : null, { role: 'delete' @@ -188,7 +188,7 @@ const roles = { process.platform === 'win32' ? { type: 'separator' - } : {}, + } : null, { role: 'selectall' @@ -209,12 +209,11 @@ const roles = { process.platform === 'darwin' ? { type: 'separator' - } : {}, + } : null, process.platform === 'darwin' ? { - label: 'Bring All to Front', role: 'front' - } : {} + } : null ] } @@ -246,7 +245,7 @@ exports.getDefaultSubmenu = (role) => { // remove empty objects from within the submenu if (Array.isArray(submenu)) { submenu = submenu.filter(function (n) { - return n.constructor !== Object || Object.keys(n).length > 0 + return n != null }) }