How to change behavior of items in Firefox context menu
I'm trying to change the behavior of <popup id="placesContext">
in placesOverlay.开发者_开发百科xul
. My goal is to disable the Properties entry upon conditions that I need to figure out using Javascript.
I am new to XBL
bindings and handlers and don't know how to register such a handler for an existing/browser-defined XUL
element. Or is there a simpler way?
Thanks.
The best way is to add a event listener for "popupshowing" events on the popup that contains the option you want to disable. It will be called just before the pop up shows and at that point you can do whatever checks you want to do and disable or enable to menuitem.
There is more information here: https://developer-stage.mozilla.org/en/XUL/PopupGuide/ContextMenus#Hiding_and_Showing_Menu_Items_based_on_Context
精彩评论