oncommand attribute is capture phase event handler?

Discuss building things with or for the Mozilla Platform.
Posts: 25
Joined: January 29th, 2005, 8:54 pm

Post Posted May 17th, 2014, 8:10 pm

I tried to cancel 'command' events of a toolbarbutton.
In Browser Console I entered this
Code: Select all
document.getElementById('downloads-button').addEventListener('command', function(e){e.stopPropagation();e.stopImmediatePropagation();e.preventDefault();e.returnValue=false;return false;}, true)

And the outerHTML of downloads-button is
Code: Select all
<toolbarbutton id="downloads-button" class="toolbarbutton-1 chromeclass-toolbar-additional" oncommand="DownloadsIndicatorView.onCommand(event);" ondrop="DownloadsIndicatorView.onDrop(event);" ondragover="DownloadsIndicatorView.onDragOver(event);" ondragenter="DownloadsIndicatorView.onDragOver(event);" label="Downloads" removable="true" cui-areatype="toolbar" tooltiptext="Display the progress of ongoing downloads" />

This should be able to cancel 'command' events of downloads-button. But it doesn't. The oncommand attribute handler fire earlier than my capture phase event handler.
Is this a bug? Or is normal behavior?

I workaround this by cancel 'click' event instead of 'command' event or attach event handler to 'nav-bar'.

Return to Mozilla Development

Who is online

Users browsing this forum: No registered users and 2 guests