See the specification at http://www.w3.org/TR/xbl/ for details of the XBL 2.0 Specification.
Bindings are handled in BindingHandler class. It tracks what is binded to where. When the document is loaded, all the bindings are loaded and added to BindingHandler. After that bindings are applied by calling applyBindings() from BindingHandler. When bindings are applied every style-, handlers- and implementation-bindings' apply method is called. Shadow trees are constructed and final flattened tree is created.
BindingHandler makes the shadow contents. First the tree under template element is copied to a vector. After that content node is replaced with a copy of bound element's children (if any). If there is no children to copy, the child of content element is used.
If there is inherited node under the template, corresponding node-to-be-inherited is tracked from the lists of bindings in BindingHandler.
It should be noted that nodes in the final flattened tree are always clones of the original nodes.
Distribution of basic shadow content creation is described in picture below. The other picture shows all the relevant classes and their relations regarding templates.
There is implemented class ScriptHandler. When handlers element is applied, all the handlers are added to the ScriptHandler. ScriptHandler then creates special XBLHAndler classes that inherit EventListener and adds corresponding listeners to bound elements.
When bound element catches event, the call traces back to ScriptHandler. There the script is then executed with ECMAScripter.
Picture below shows most important classes and their relations regarding handlers.
Styles are applied to bound element by calling the copyPropertySet() method. After that, styles are set also to the bound element's children. Style is also set to possible style element's sibling template element.
Copyright (c) 2000-2008 X-Smiles.org et.al.