Closed Bug 356697 Opened 19 years ago Closed 17 years ago

the oncommand attribute in a menuitem element cannot be changed multiple times

Categories

(Firefox :: Menus, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 381518

People

(Reporter: linuxed7, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061003 Firefox/2.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061003 Firefox/2.0 This bug can be reproduced 100% of the time. If you are using a menupopup specifically for a statusbarpanel element, a bug will occur with the oncommand attribute of a menuitem element anytime you try to change it's value. The first time you change the value it will work fine, accepting the new function to be executed when the oncommand event is triggered. However, if you try to change the value again the oncommand event will continue to execute the previously entered code instead. Basically you can change the attribute's value one time only. After that it doesn't matter what code you include in the oncommand attribute it will continue to use the previous code. The extension that I'm working on needs to frequently change the function arguments that are stored in the oncommand attribute. The only way to workaround it is to remove the oncommand attribute and then add it again. Example: document.getElementById('menuitem_name').removeAttribute('oncommand'); document.getElementById('menuitem_name').setAttribute('oncommand','alert("test2");'); Reproducible: Always Steps to Reproduce: 1. You can test this by opening the DOM Inspector and navigating to a statusbarpanel menupopup element. 2. Select a menuitem and change the oncommand value to alert('test1'); 3. Then click the statusbarpanel and click the item you just changed. 4. An alert box should popup saying 'test1'. 5. Go back to the DOM Inspector and change the value to alert('test2'); 6. Then click the menuitem you changed and an alert box will popup that still says 'test1' when it should be saying 'test2'. Actual Results: The oncommand attribute never gets changed the second time. Expected Results: The alert box should display 'test2'. Extensions in use: Cookiesafe Jsview Dom Inspector NoScript RefControl ShowIp Theme in use: Noia 2.0
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.