Web Components (XBL2)

From RuntimeWiki

Jump to: navigation, search

This feature request is about providing a real component model such as XBL to W3C formats, particularly HTML and SVG.

The W3C has a candidate recommendation in this area now, XBL2:

With XBL, you define a custom element, e.g., <foo:bar>, which is defined as an HTML or SVG snippet, JS logic (which has event handlers for instance change events, such as component load event hanlders), and supplemental assets (e.g., CSS and images) used by the component. XBL is a clean and robust way to define custom widgets. Some Ajax widget vendors would much rather build widgets using XBL than the HTML hacks that they must use today. XBL is similar to the VisualTree feature in XAML/Silverlight in that the original markup is preserved in the DOM. A separate "shadow DOM" contains the HTML or SVG snippet (and associated JS, CSS and images) that provides the component's rendering.

XBL2 has been around for a number of years and is not yet shipping in any of the major browsers. Mozilla claims they are actively working on it:

"XBL1" (the basis for XBL2) has shipped in Mozilla since 1999. Microsoft has shipped a similar feature (behaviors) since around 2000.

One criticism of XBL2 as it stands today is that it embraces XML namespaces, which leads to a requirement for XHTML instead of HTML, which appears in conflict to the movement in HTML5 away from any dependencies on XML or XML namespaces.

Personal tools