Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html5 & callback is not actually working #564 #757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daveherman71
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant