DOMLib: tiny cross-UA DHTML API provides compatibility with W3C DOM


the end of interview signified by three dashes, a space and the text string
"End of
Interview" (without the quotes) -- more information/resources on DOMLib
included following the text of the interview, which i thought sufficiently
topic for the UA WG to quote in full...  (this was supposed to go out to the
list back in june, but apparently didn't)

--- Beginning of Interview

This week we interview Pascal Bestebroer, author of DOMLib, a
tiny cross-browser DHTML API for DOM compatible browsers.
1. INTERVIEW: DOMLib's Pascal Bestebroer

First reported in the newsletter this week we
expand our interview with DOMLib's author, Pascal Bestebroer.

DOMLib is a new cross-browser DHTML library written for DOM
compatible browsers (including IE5+, NS6+, etc.). DOMLib was
developed by Pascal Bestebroer, who previously helped develop
DynAPI2. DOMLib is a very compact API containing roughly the same
functionality as found in the DynaCore/DynAPI2 libraries. The
core library weighs in at a mere 3Kb.

DOMLib is part of a trend we're seeing towards sleeker, more
standards-compliant pages designed for newer browsers like IE5
and NS6. Combined with CSS, DOMLib can help you create compelling
layouts with interactivity, using less code. We caught up with
Pascal and asked him about his new DHTML API.

>WR: Tell us about DOMLib?

PB: DOMLib is my attempt at a lightweight slick DHTML API
supporting only the W3C DOM standards (and some of Microsoft's :)
It will be different from DynAPI2 in a few ways, especially
widgets (buttons, toolbars, etc.) will be done differently because
DOM is much more flexible, and you have the power of CSS. They
will be smaller, and should provide roughly the same functionality
and ease of use.

>WR: Why did you decide to develop DOMLib?

PB: I started working on new DynAPI code for DOM compatibility...
but while trying things I figured that I could do a DOM library
using only a few lines of code, but providing almost the same
functionality as the DynAPI2 (using much more code and memory).
So I started from scratch and DOMLib is the result (but don't get
me wrong, if you need full cross-browser compatibility and power
for older generation browsers as well... DynAPI2 is still the
best thing out there so use it... DOMLib will only support DOM
and IE5+ compatible browsers).

>WR: What can you do with DOMLib?

PB: Basically you can do Dynamic HTML with more ease for DOM
compatible browsers. I'm just not a Flash addict and hate the idea
of Flash plugins for animation and stuff. For me DHTML is more
"real" and so DOMLib should be providing Web designers with the
power to do great animations without Flash.

Scripting for DOM browsers isn't really hard to do, and could
probably be done without a library such as DOMLib, but DOMLib
makes it easier to do certain things on the fly, and for
developers it's usually easier to use a library that fixes small
bugs and incompatibilities automatically.

>WR: More specifically?

PB: Basically any widgets you can think of are possible, and they
are very easy to create. A button could be done using style sheets
on a single layer (as shown in one of the exmples), but also
people should keep in mind that the components to create forms are
already available... you can change the look of a form component
(inputbox, listboxes, etc) using style sheets. You can specify
borders, colors, size, position of every form component, so no
need to create widgets for them.

Hierarchical menus are also possible, but to be honest these
"simple" things can be done even without the DOMLib. On my website
I use a toolbar that is created using a document.write statement.
The toolbar is created using a single string where I add the menu
structures to. I use some div's, tables and a lot of style sheets
to make the menu work. The menu could be (and will eventually be)
extended to have submenus, but the idea of submenus is the same
as normal menus: create the string, add it to the main string, and
document write the menu with a single document.write() call.

I think that you'll only need the DOMLib if you want to do more
advanced stuff, like games, weird animations and bigger widgets.
My best example would be the realtime 3D example on my website.
It shows that things like 3D rotations can be done, it uses dynamc-
realtime scaling of images (images are 64x64 pixels in size, and
are scaled according to their distance) and realtime 3D
calculations. Developers should start using their imagination to
create things that others haven't done yet, and use my DOMLib in
the process :)

>WR: What specific browsers/platforms does it support?

It should support all 100% DOM compatible browsers. But sadly I
can only test code on IE5/IE5.5, Mozilla (always latest release)
and Opera on Windows machines.  Luckily if things work under
Mozilla under Windows, it should work under Linux and all other
platforms Mozilla runs on. Of course help for fixing bugs on other
platforms is always appreciated (hint, hint :) [Ed: His front page
menus work on IE5/NS6 Mac.]

>WR: How well do each of the v5+ browsers support the DOM?

PB: I think the best one is Mozilla, even though I think the
browser is bloated (as the previous Netscape versions were) it's
shaping up to be a very impressive browser, handling most of the
stuff the W3C DOM needs. Internet Explorer 5+ is a great browser
as well, but not 100% compliant with standards. Not sure if this
is a bad thing though, Microsoft has put a lot of nice extras into
the browser (I think the transparency filter was copied by Mozilla
because of the coolness of it :). You can clearly see that
Microsoft's browser is getting to the DOM standard, but contains
extra features that are very useful for Web applications.

And finally Opera, this browser could be the best: it's fast, small,
renders almost perfect, works on many different platforms... but
doesn't do dynamic stuff (yet). You can't create HTML elements on
the fly or change style sheets of HTML elements. This is just a
very big problem when you want to do DHTML. I truly hope that
Opera makes those things a priority, because that could make Opera
one of Microsoft's biggest nightmares (I'm dreaming, I know :)

>WR: Even with newer browsers supporting the DOM to varying degrees,
     how do you resolve the differences between them? (box models,

PB: Sadly the only browser I have problems with is Opera, I just
can't work around the limitations. The other browsers I tried
haven't thrown any problems. Usually I just try the code in a
browser, and try to track down the few lines that make things go
wrong (using many alerts and browser-reloads to check variables
and values). Then if, for example, the browser doesn't handle a
certain stylesheet property, I use a small piece of code to
display all the properties available in the element.

For example:

   for (var i in window.document) tmp+=i+' |  '

That will show all available properties in the window.document
object, and that way you can check if a certain property might
have another name, or is placed under another child [object]...
and then it's just a lot of testing and trying... damn I love
developing :)

>WR: What are your future plans for DOMLib?

PB: I think the most important thing for a DHTML library is
animation, and that's probably what I will be focusing on. This
means having some sort of timeline editor to do smooth animations
of multiple layers at key-frame intervals. There's already some
basic code in the current release, but I'm working on some ideas
to make it more powerful and still easy to use. Thinking about
things like timing and triggering of animations... not sure yet
how to do it all, but I'm pretty sure it's possible.
--- End of Interview

in following up, at , i found the

I plugged the small memory leaks that happened in IE, always thought
it was just the browser it self.. but it seems that if you have
javascript variables pointing to DOM elements, these
variables/elements are not freed. Now there's an onunload handler in
the DOMLib that makes sure all created DomElements are disconnected
from the real DOM elements, so no more memory leaks.


I started doing a simplistic Animation manager, see example for this.
It's actually already very powerfull, you specify the x and y speed
values and how many frames it should repeat that speed and then
optionally provide a function that should be executed at the end of
those frames. All it needs now is a timeline editor :)

which is interesting information, but quite strangely presented (at
least, that was this user's experience) -- the interface of the
dynacore site, when entered from the top level is confusing enough
to shake one's (ok, my) confidence, but then, i wouldn't expect
anyone to follow any of the links in my sig files after actually
reading one of my posts to the bitter end, either...

in any event, i've posted this to the list because i'm not well versed
enough with the practicalities of the DOM to evaluate DOMLib -- i only know
the DOM on a theoretical level, never having programmed to it, and in any
event, i'm not currently in a position to do so anyway, given the
infrastructural instability...  however, it struck me that, even if DOMLib
doesn't really have any direct bearing on what UAAG is attempting to
facillitate, then, at the very least, its changelog, release notes, and
examples will probably be of great utility to anyone attempting to interface
with the W3C DOM, especially as it claims to be able to interface with IE's
proprietary DOM as if it were W3C compliant, which would be one means of
enabling AT vendors to develop to a single spec -- the W3C DOM, without
compromising functionality/compatibility with IE...

DOMLib has a homepage, which is:

a more formal (and actually quite nicely organized & executed)
introduction, as well as documentation, release notes, etc. begins


Received on Thursday, 26 July 2001 16:00:08 UTC