我有这个 xml 绑定:
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="tbb" role="xul:toolbarbutton" extends="chrome://global/content/bindings/button.xml#button-base">
<resources>
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="tbb" role="xul:toolbarbutton" extends="chrome://global/content/bindings/button.xml#button-base">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css" />
</resources>
<content>
<children includes="observes|template|menupopup|panel|tooltip" />
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label" flex="0" />
<xul:image class="profilist-badge" xbl:inherits="validate,src=badge,label" width="1" flex="0" />
<xul:label class="toolbarbutton-text" crop="right" flex="1" xbl:inherits="value=label,accesskey,crop,wrap" />
<xul:label class="toolbarbutton-multiline-text" flex="1" xbl:inherits="xbl:text=label,accesskey,wrap" />
</content>
</binding>
<binding id="tbb-box">
<content>
<children/>
<xul:box class="profilist-submenu">
<xul:image class="profilist-closed" />
<xul:image class="profilist-build" />
<xul:image class="profilist-safe" />
<xul:image class="profilist-default" />
<xul:image class="profilist-rename" />
<xul:image class="profilist-del" />
</xul:box>
</content>
</binding>
</bindings>
我想要做的是放置一个toolbarbutton
使用我在上面定义的绑定的 id'ed profilist-tbb
。我想在 XBL 文件中执行此操作。而不是让 css 告诉应用您知道的绑定?
我试过了,工具栏按钮甚至没有被创建:(
<binding id="tbb-box">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css" />
</resources>
<content>
<toolbarbutton class="rawr"></toolbarbutton>
<xul:box class="profilist-submenu">
<xul:image class="profilist-closed" />
<xul:image class="profilist-build" />
<xul:image class="profilist-safe" />
<xul:image class="profilist-default" />
<xul:image class="profilist-rename" />
<xul:image class="profilist-del" />
</xul:box>
</content>
</binding>
谢谢