Tony
Tony

Reputation: 507

Firefox extension elements id

Can someone tell me where can I find the ids of browser elements in Firefox?

I want to put a menupopup in the web developer section in Firefox and I need an id to put into the insertafter attribute.

Upvotes: 1

Views: 358

Answers (2)

jongo45
jongo45

Reputation: 3090

The web developer menupopup can be found in:

http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-appmenu.inc#144

<menupopup id="appmenu_webDeveloper_popup">
  <menuitem id="appmenu_devToolbox">
  ...

Alternatively, If you have DOM Inspector, open it and go to menu:

File->Inspect Chrome Document->chrome://browser/content/browser.xul

(browser.xul should usually be the first item (1) with the same title as the browser's taskbar or current tab).

Then search for ID=appmenu_webDeveloper_popup. Many of the other menus can be found at ID=mainPopupSet.


Also, this scratchpad snippet lists the IDs of child elements contained in the web developer menupopup (set scratchpad environment to browser, execute as display to output the result ):

var webdev=document.getElementById("appmenu_webDeveloper_popup");
var idList=Array.prototype.slice.call(webdev.children).map(function(node){
    return node.id;
}).filter(function(id)id);
idList.join("\n");

Upvotes: 0

Wladimir Palant
Wladimir Palant

Reputation: 57651

You can see all the IDs in the source code of browser.xul as well as its include files like browser-sets.inc. Alternatively, you can inspect the browser window at runtime using the DOM Inspector extension.

Upvotes: 1

Related Questions