【发布时间】:2014-08-09 06:58:06
【问题描述】:
我有这个 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,它使用我在上面定义的绑定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>
谢谢
【问题讨论】:
-
Err.. 你在尝试什么?我无法理解你的问题?另外,绑定中的重复行是复制/粘贴错误,还是真的像 XBL 文件中的那样?
-
真的是这样 :( 感谢您的回复,我非常需要帮助。我的问题是,当我禁用
box时,我希望工具栏按钮与其他一些东西一起继承它。所以我试图制作一个新的 xbl 元素,它是一个工具栏按钮。我希望使用我的 xml#profilist-tbb中的第一个绑定来扩展该工具栏按钮,然后我想将该扩展的工具栏按钮放在我的框中#profilist-tbb-box
标签: binding firefox-addon xbl