jQuery-contextMenu icon indicating copy to clipboard operation
jQuery-contextMenu copied to clipboard

html5 & callback is not actually working #564

Open daveherman71 opened this issue 4 years ago • 0 comments

To preserve legacy compatibility when building the menu from a HTML5 menu element I propose that you check for the existence of the onclick property on the button, menuitem or command tag and if one does not exist then call the root callback function as a fallback:

    callback: (function () {
        return function () {
            $node.get(0).click();
        };
    })()

Therefore becomes:

    callback: (function () {
        return function (itemKey, opt, ev) {
            if ($node.get(0).onclick !== null) {
                $node.get(0).click();
            } else {
                opt.callback(itemKey, opt, ev);
            }
        };
    })()

I have no need for legacy compatibility in my app but this works well for me especially when building large menus using the suckerfish methodology.

daveherman71 avatar Nov 12 '21 14:11 daveherman71