diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index 6fb5489f42bd..c0e9c202ef54 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -56,6 +56,11 @@ Menu.prototype.popup = function (window, x, y, positioningItem) { [newPosition, newY, newX, newWindow] = [y, x, window, null] } + // menu.popup([w], x, y, callback) + if (typeof newPosition === 'function') { + callback = newPosition + } + // menu.popup({}) if (window != null && window.constructor === Object) { opts = window diff --git a/spec/api-menu-spec.js b/spec/api-menu-spec.js index 32ee985de322..a15fd5f83cda 100644 --- a/spec/api-menu-spec.js +++ b/spec/api-menu-spec.js @@ -328,6 +328,11 @@ describe('Menu module', () => { menu.popup({}, () => done()) menu.closePopup() }) + + it('works with old style', (done) => { + menu.popup(w, 100, 101, () => done()) + menu.closePopup() + }) }) describe('Menu.closePopup()', () => {