0

我有这个疯狂的问题。一类不适用于我用 XBL 添加.profilis-tbb的匿名元素“ ”。.profilist-tbb-box

我有一个带有两个绑定的 xbl 文件。#tbb#tbb_box#tbb扩展toolbarbuttonwhich 有类.profilist-tbb,这#tbb_box是一个包含 this 的盒​​子元素toolbarbutton

好的结果看起来像这个图像,它看起来像这样,但仅在 Windows 上。

和 DOM Inspector 这个好东西(在 Windows XP、7、8.1 上):

现在问题出在 Linux 和 Mac 上,toolbarbutton没有采用 CSS。此图像来自 Linux:

在 Linux 中,尽管#tbb_boxXBL 成功应用(即使工具栏按钮没有):

结构是这样的,在 XUL 中我添加了一个盒子元素并赋予它类:

['xul:box', {class:'profilist-tbb-box', label:'blah'}];

然后这是适用的 XBL:(在 profilist-tbb 和 linux/max 的情况下,它应该适用,但不适用)

```
.profilist-tbb-box {
    -moz-binding: url('chrome://profilist/content/xbl.xml#tbb-box');
}
.profilist-tbb {
    -moz-binding: url('chrome://profilist/content/xbl.xml#tbb');
}
```

XBL 文件:

```
<?xml version="1.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" xmlns:html="http://www.w3.org/1999/xhtml">
    <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:stack class="profilist-display-stack" flex="1">
                <html:input class="profilist-input" xbl:inherits="value=label" />
                <xul:label class="toolbarbutton-text" crop="right" flex="1" xbl:inherits="value=label,accesskey,crop,wrap" />
            </xul:stack>
        </content>
    </binding>
    <binding id="tbb-box">
        <content>
            <toolbarbutton class="profilist-tbb" xbl:inherits="label,disabled" />
            <xul:box class="profilist-submenu" xbl:inherits="disabled">
                <xul:image class="profilist-is-default" xbl:inherits="disabled" />
                <xul:image class="profilist-clone" xbl:inherits="disabled" />
                <xul:image class="profilist-dots" xbl:inherits="disabled" />
                <xul:image class="profilist-dev-build" xbl:inherits="disabled" />
                <xul:image class="profilist-dev-safe" xbl:inherits="disabled" />
                <xul:image class="profilist-default" xbl:inherits="disabled" />
                <xul:image class="profilist-rename" xbl:inherits="disabled" />
                <xul:image class="profilist-inactive-del" xbl:inherits="disabled" />
            </xul:box>
        </content>
    </binding>
</bindings>
```

请帮我弄清楚为什么 XBL 不适用于框内的工具栏按钮。

4

1 回答 1

0

我通过删除toolbarbutton我切换到这个 XBL 来解决这个问题:

注意我是如何<toolbarbutton>用第一个绑定中的元素替换元素的。所以现在只有一个绑定。

于 2014-09-06T08:46:44.643 回答