Ajax JavaScript CSS HTML 5 DOM

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, as explained in section Embedding SVG.

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

Forum

XUL or XAML or what?

Sat, 03 May 2008 17:25:50

pasx2578

All, Our goal is to extend an existing C++ app and port the UI to a system in which it'll be easier to maintain and extend and be multiplatform. I am far from an expert in the field of XUL or XAML and only doing preliminary research work here. It looks like our options are: .net: create the UI in .net/c# using VS and expose the methods we need so that our C++ program can exchange with its UI. Fine for the Windows platform but I do not have much visibility on portability to Linux using Mono. XAML: sounds like this is going to be a de facto standard anyway. But we still need to address the portability to Linux issue. The other problem is that although the .net/C# solution is just great IMHO, the asp .net stuff is by contrast complex and slow. So I am a bit afraid that the whole XAML/.net solution might be a bit overkill for us. XUL in that regard seems much more simple. And we still have people who have yet to make the move to .net 2.0... XUL: looks like the solution for us. XULRunner is much easier to install. I wonder about the connection to our C++ app through XPCom/XPConnect though. I also wonder if XUL will not simply be swept away by the Microsoft caterpillar. But Linux still there and Apple and Netscape too... Any advice on that would be appreciated. I mean technical advice not your feelings about antitrust legislation loopholes... Thanks
Sun, 04 May 2008 18:46:00

Administrator

A comparison of all the platforms is made in this article: Comparison of XML user interface languages Each format has its advandages and drawbacks: - XUL is portable but very hard to master. - Ajax is simple on the Web, but locally it requires Gears or similar, a solution for the future maybe. - XAML seems to be portable but the developement depend on Microsoft's tools. Finally using XML for the interface is not as simple as it would be. But there are some XUL application around, this is not impossible.
License: © 2010-2013 Xul.fr - All rights reserved.