blob: 554771a0499ea320fa69f65106311e9f6eb71e8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
title: XBL
slug: Archive/Mozilla/XBL
tags:
- XBL
translation_of: Archive/Mozilla/XBL
---
<p><strong>XML 绑定语言</strong> (<strong>XBL</strong>,有时也被称为可扩展绑定语言)是用于描述可以附加到其他文档中的元素的“绑定”(bindings)的语言。绑定所附加到的元素被称为<em>绑定元素</em>(bound element),会获取绑定中指定的新行为。</p>
<p>绑定可以包含在绑定元素上注册的事件处理器(event handlers)、可从绑定元素访问的新方法(methods)和属性(properties)、以及插入到绑定元素下的匿名内容。</p>
<p>Most <a href="/en/XUL" title="en/XUL">XUL</a> widgets are at least partially implemented using XBL. You can build your own reusable widgets from existing <a href="/en/XUL" title="en/XUL">XUL</a>, <a href="/en/HTML" title="en/HTML">HTML</a>, <a href="/en/SVG" title="en/SVG">SVG</a>, and other primitives using XBL.</p>
<h3 id="Specifications" name="Specifications">定义</h3>
<ul>
<li>XBL 1.0 is specified in <a href="/en/XBL/XBL_1.0_Reference" title="en/XBL/XBL_1.0_Reference">XBL 1.0 Reference</a>. Unfortunately, the actual implementation in Mozilla is different from the specification, and there's no known document available describing the differences. Hopefully, the Reference will be updated to describe those differences.</li>
</ul>
<p>XBL 1.0 是一个 Mozilla-specific technology,不是一个 <a class="external" href="http://w3.org/">W3C</a> 标准。至少两个基于它的标准已经被废弃:sXBL 和 XBL 2.0。</p>
<div class="warning">
<p>警告!sXBL 和 XBL 2.0 已被废弃。</p>
</div>
<ul>
<li>W3C <a class="external" href="http://w3.org/TR/sXBL/">sXBL</a> (currently a working draft, 2005) stands for <em>SVG's XML Binding Language</em>. It is supposed to include a subset of XBL 2.0 features needed for <a href="/en/SVG" title="en/SVG">SVG</a>. It's similar in spirit to Mozilla's XBL, but there are a few subtle (and not-so-subtle) differences. For example, names of the elements are different. Also sXBL lacks some features of XBL, such as bindings inheritance and defining methods/properties on bound elements.</li>
<li><a class="external" href="http://www.mozilla.org/projects/xbl/xbl2.html">XBL 2.0</a> (<a class="external" href="http://w3.org/TR/XBL/">W3C Candidate Recommendation</a>) is being developed to address problems found in XBL 1.0 and to allow for implementations in a broader range of Web browsers. Mozilla plans to implement XBL2 in future versions of <a href="/en/Gecko" title="en/Gecko">Gecko</a> with <a class="external" href="http://groups.google.com/group/mozilla.dev.tech.xbl/msg/d7d4f279ebdad65f" title="http://groups.google.com/group/mozilla.dev.tech.xbl/msg/d7d4f279ebdad65f">initial stages</a> started in June 2009.</li>
</ul>
<p>Some differences between sXBL and XBL2 are listed in <a class="external" href="http://annevankesteren.nl/2005/11/xbl">an article by Anne van Kesteren</a> (November, 2005).</p>
<p>An overview of differences between Mozilla XBL and XBL2 is in a <a class="external" href="http://groups.google.com/group/mozilla.dev.tech.xbl/msg/af3d4e37cce1d907">newsgroup posting by Jonas Sicking</a> (April, 2007).</p>
<div class="geckoVersionNote">
<p>Still living "Shadow DOM" related specs</p>
</div>
<ul>
<li><a href="http://www.w3.org/TR/shadow-dom/">Shadow DOM</a> (<a href="http://w3c.github.io/webcomponents/spec/shadow/">Editor's Draft</a>)</li>
<li><a href="http://dev.w3.org/csswg/css-scoping/#shadow-dom">CSS Scoping » Shadow Encapsulation</a></li>
</ul>
<h3 id="See_also" name="See_also">参见</h3>
<ul>
<li><a href="/en/XUL_Tutorial/Introduction_to_XBL" title="en/XUL_Tutorial/Introduction_to_XBL">Introduction to XBL</a> from the <a href="/en/XUL_Tutorial" title="en/XUL_Tutorial">XUL Tutorial</a>.</li>
<li><a href="/en-US/docs/XUL/School_tutorial/Custom_XUL_Elements_with_XBL" title="/en-US/docs/XUL/School_tutorial/Custom_XUL_Elements_with_XBL">Custom XUL Elements with XBL [en-US]</a> from the <a href="/en-US/docs/XUL/School_tutorial" title="/en-US/docs/XUL/School_tutorial">XUL School Tutorial [en-US]</a> for add-on developers</li>
<li><a class="external" href="http://mb.eschew.org/15.php">XBL chapter</a> of <a class="external" href="http://mb.eschew.org/">"Rapid Application Development with Mozilla"</a></li>
<li><a class="external" href="http://www.w3.org/TR/xbl-primer/">XBL 2.0 Primer</a> (draft)</li>
<li><a class="external" href="http://code.google.com/p/xbl/" title="http://code.google.com/p/xbl/">XBL 2.0 Cross-browser implementation in JavaScript</a></li>
</ul>
<ul>
<li><a href="/en-US/docs/tag/XBL">更多 XBL 资源…</a></li>
</ul>
<h3 id="Community" name="Community">社区</h3>
<ul>
<li>查看 Mozilla 论坛上的讨论…</li>
</ul>
<p></p><ul>
<li><a href="https://lists.mozilla.org/listinfo/dev-tech-xbl"> 邮件列表</a></li>
<li><a href="http://groups.google.com/group/mozilla.dev.tech.xbl"> 新闻组</a></li>
<li><a href="http://groups.google.com/group/mozilla.dev.tech.xbl/feeds"> Web feed</a></li>
</ul><p></p>
|