javascript - passing clicked element to the context menu action in Firefox -
i trying write simple extension, take link right-clicked on, reformat url , launch in external application. have pieces working 1 exception.
i using "popupshowing" listener deduce whether element right-clicked link or not , show or hide "launch" command in context menu respectively. overlay code looks this:
<menupopup id="contentareacontextmenu"> <menuitem id="linkopener" label="launch" oncommand="launchit(document.popupnode);" /> </menupopup> works charm, according docs, document.popupnode being phased out , should use menupopup's triggernode instead. however, can't pass inline "oncommand" handler more.
what's best way that? 1 can think of right go function handles "popupshowing" event, remove old "command" listener previous element reference , add new 1 new reference, feels there might better way this. appreciated. thanks! luka
solved: since menuitem child of menupopup, can this:
<menuitem oncommand="myfunc(this.parentnode.triggernode);">
Comments
Post a Comment