XUL vs. HTML 5
XUL in XULRunner is a way to add native code to an HTML 5 application, by encapsulating in a XUL window.
Otherwise what is the future of XUL? The question is proeminent, especially seeing as Mozilla launches the project of a navigator no longer using XUL, its own language interface, but rather HTML 5.
And it does so because the Gecko rendering engine being able to present web pages in HTML 5, it might be lighter if the XUL language processing is removed.
Remains the question whether HTML 5 can completely replace XUL.
Comparing technologies
A XUL application uses a language derived from XML to structure the page, CSS for presentation, JavaScript for interaction with the user, DOM to access content in items.
Note that XUL extends DOM with new methods such as getElementsByAttribute.
An application or Web page uses HTML5 or XHTML 5 both derived from XML, and also CSS, JavaScript and DOM.
As for SVG, it can fit into the HTML and XUL code too.
Thus the two languages are based on Web standards. To differentiate we must therefore look to their tags and other features
Comparing tags
Three tags are crucial: Canvas, Video and Audio. The first allows virtually doing whatever you want in terms of interface and animation, the other two have a very frequent use that makes them indispensable.
Canvas
Canvas in XUL and HTML 5 is a tag representing a drawing surface (in Silverlight is a container for other tags graphs).
However the canvas tag of XUL is only a project, while it is already implemented in HTML 5.
Video and Audio
XUL does not have any of these two tags essential for a webpage, but not necessarily useful in an application.
There is a way to add them: embedding HTML code in XUL.
Widgets
The graphics builtin components are richer in XUL compared to form objects in HTML 5.
For example, XUL provides a tree object, advanced layout tags such as Grid, a template system.
You can build HTML equivalents components but on this plan again, XUL has an advantage because it has the XBL language to facilitate the definition of new widgets.
The advantages of XUL
View-control Model
The use of RDF for widgets allows to define alternative content defined in different files. See an example in the RDF tutorial.
We may add events to components with JavaScript code, but XUL has superior ability in responses to changes in states and interactions between components.
XPCOM
This is an interface to external libraries written in different languages. Functions written in C may be used from JavaScript.
This give access to native code, such as the Native Client from Google for Web applications.
Databases
XUL can connect directly to a database with XPCOM and an extension has been specially developed by Mozilla for SQL, see SQL support in Mozilla, but it was written some years ago.
The use of XPCOM is more complex than the use of Ajax coupled with scripts on the server.
XPInstall
An automated installation system for XUL applications. Runs from the Firefox browser.
Locale
The structure of any XUL application includes a local directory for the various translations of labels. The mapping is automatic.
Compatibility
Running a XUL application requires the Firefox browser or XULRunner runtime. For its part, HTML 5 will work soon on all browsers and on all systems including mobiles.
There is a light version of Firefox for mobile codenamed Fennec.
Conclusion
The decisive advantage of XUL to HTML is the ability to insert HTML in XUL interface. This gives access to all tags that HTML has plus those it lacks.
XUL seems better suited to build a complex interface with its layout tags, and the language of description of widgets can also build a library of reusable components. When XUL provides additional capacity it is always at the cost of great complexity but it allows the inclusion of native APIs.
HTML 5 is suitable for rapid development and portable applications. The use of a JavaScript framework can provide additional widgets.
See also
XUL or XAML or what?
pasx2578
Administrator