XUL implicit elements
I've been playing开发者_如何学Python around with buttons in XUL. I discovered that when you put an image on a button it creates an image element inside that button, I know this, because I can style that image with the CSS selector 'button image'.
So, my question is what other implicit elements are there? I want to have a white menu arrow and I can't work out what its called.
They are called "anonymous nodes" and you can see them in DOM Inspector for example. If you prefer to inspect them programmatically, document.getAnonymousNodes() or document.getAnonymousElementByAttribute()
will give you them ("normal" DOM methods won't, they ignore anonymous nodes). Anonymous nodes are usually created via XBL, e.g. the default XBL bindings for buttons can be found in chrome://global/content/bindings/button.xml
(anonymous nodes are defined in the <content>
tag). In Firefox 5 this corresponds to the directory chrome/toolkit/content/global/bindings/
in omni.jar
- feel free to browse around in this directory (the bindings are assigned in chrome/toolkit/content/global/xul.css
). When styling anonymous nodes keep in mind that the anonymous nodes will sometimes depend on the operating system (see <dialog> binding for an example, note the preprocessor directives choosing code parts based on operating system).
精彩评论