[Project_owners] 'command' attribute breaking menuitems?

Andy McDonald andy_mozdev at stemhaus.com
Sun Nov 6 16:26:35 EST 2005


It seems that a 'command' attribute on a <menuitem/> prevents that 
menuitem from being selected in a dropdown (i.e. <menulist>). Here's an 
example, which you can try using the Real-time XUL Editor at 
http://ted.mielczarek.org/code/mozilla/xuledit/

------------------------
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<commandset>
    <command id="cmd_test" oncommand="alert('Clicked')"/>
</commandset>

<menulist>
    <menupopup>
       <menuitem label="1"
             oncommand="document.getElementById('cmd_test').doCommand()"/>
       <menuitem label="2"/>
       <menuitem label="3" command="cmd_test"/>
    </menupopup>
</menulist>

<button label="Clicky" command="cmd_test"/>
</window>
------------------------

Specifically, try to select '3': you can't. Can anyone explain why the 
'command' attribute on label '3' causes this, and the doCommand() 
version does not?

Thanks,
Andy

-- FoxClocks


More information about the Project_owners mailing list