March 2021
Mo Tu We Th Fr Sa Su
<< >>


Javascript and W3C DOM

Posted on Mar 11 2006

I'm currently writing the Haxe interfaces for Javascript DOM API. What a mess ! There is the W3C DOM, which is a recommended standard, with several versions, not completely implemented on different browsers, then each browser comes with its own extensions, sometimes compatible across browsers, sometimes incompatible.

It is then not easy to come up with a single interface. What I'm doing for Haxe is the following :

  • have the standard interface supporting the things supported by both IE6 and Firefox 1.0.x
  • have several compilation flags to disable some fields and ensure more strict compatibility
  • the ie5 flag will ensure ie5 compatibility by disabling ie6-specific fields
  • the w3c flag will disable fields that are not w3c compatible

Conditional compilation is really a great help there. In the future when interfaces improve I will add the latest FireFox 1.5 APIs that will be turned ON with ff15 or another flag.

Other problem is inherent dynamics of some fields, that can be of several types (Integer or String, with different formats). Having more strictly typed and sound API will be something interesting, but difficult to do. If I could get a hold on the guy responsible for all of this, I would have a few words to say to him :)

Hopefully Haxe will greatly help developers to go through this jungle.

0 comment
Name : Email : Website : Message :