oncommand attribute is capture phase event handler?

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

oncommand attribute is capture phase event handler?

Post by pwong »

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'.
Post Reply