---
title: XBL
slug: Archive/Mozilla/XBL
tags:
- XBL
translation_of: Archive/Mozilla/XBL
---
XML 绑定语言 (XBL,有时也被称为可扩展绑定语言)是用于描述可以附加到其他文档中的元素的“绑定”(bindings)的语言。绑定所附加到的元素被称为绑定元素(bound element),会获取绑定中指定的新行为。
绑定可以包含在绑定元素上注册的事件处理器(event handlers)、可从绑定元素访问的新方法(methods)和属性(properties)、以及插入到绑定元素下的匿名内容。
Most XUL widgets are at least partially implemented using XBL. You can build your own reusable widgets from existing XUL, HTML, SVG, and other primitives using XBL.
定义
- XBL 1.0 is specified in XBL 1.0 Reference. 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.
XBL 1.0 是一个 Mozilla-specific technology,不是一个 W3C 标准。至少两个基于它的标准已经被废弃:sXBL 和 XBL 2.0。
- W3C sXBL (currently a working draft, 2005) stands for SVG's XML Binding Language. It is supposed to include a subset of XBL 2.0 features needed for SVG. 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.
- XBL 2.0 (W3C Candidate Recommendation) 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 Gecko with initial stages started in June 2009.
Some differences between sXBL and XBL2 are listed in an article by Anne van Kesteren (November, 2005).
An overview of differences between Mozilla XBL and XBL2 is in a newsgroup posting by Jonas Sicking (April, 2007).
Still living "Shadow DOM" related specs
参见