croczilla.com 
 home   zap   svg   xtf   jssh   bits&pieces   blog   personal   
  home > xtf

XTF - an eXtensible Tag Framework for Mozilla

XTF is a framework for implementing new XML elements for Mozilla.

This page is considerably out-of-date. For an up-to-date (2007) tutorial, see Alex Vincent's blog post here.

Old news

08 October 2004: I've started updating the XTF documentation on this page. More soon.

07 October 2004: The XTF branch has now landed on the trunk. See mozilla/content/xtf/readme.txt for more info. Hopefully I'll manage to upload some samples here in a little while.

Build instructions

To build Mozilla with xtf support you need to add the configure option '--enable-xtf':

cd mozilla
echo ac_add_options --enable-xtf >> .mozconfig
make -f client.mk

Main features

  • XTF elements are defined in C++ or JS (or any other XPCOM-compatible language) in an XPCOM component.
  • Rather than having to be bound through a stylesheet as in XBL, XTF elements are automatically recognised when encountered by Mozilla. An XTF module just needs to register a factory for the namespace it wants to service under a ContractID of the form '@mozilla.org/xtf/element-factory;1?namespace=urn:mynamespace'.
  • Can use 'proper' inheritance (not limited to 'extends' like XBL).
  • Data hiding, public/private interface: In contrast to XBL, there is full control over which parts of an element's implementation are to be exposed publicly.
  • Control over scripting interfaces exposed by the element.
  • Support for implementation-only (== display:none) elements and xul/html/svg-compatible 'visuals', where the visual appearance of the element is specified using xul/html/svg primitives (similar to the <content>-section in XBL, but dynamically generated).

XTF Interfaces