RE: Older Sibling?

>There're several other queries like this which could usefully
>be added and which might allow for similar optimizations:
>precedes in document order; is an ancestor of; least common
>ancestor; depth from root etc.

Just a coding tip:

If an optimized operation isn't supported directly in the DOM, consider
writing a library routine to encapsulte it. This could use custom calls
against DOM implementations that provide shortcuts, but fall back on
standard DOM operations for those which don't have such features.

Definitely not as nice as a standard solution, since the wrapper routines
would have to be aware of specific implementations. That makes it a
maintainance pain; you have to enumerate those implementations and maintain
their special-cases individually. And there is a bit of overhead.

But this sort of approach isn't uncommon right now, as folks try to take
advantage of custom features without losing portability (or benefit from
Level 2 features without losing the ability to manipulate Level 1 DOMs)...
and it has the advantage that if a standardized solution does become
available, the wrapper can be trivially switched over to use it without
impacting the rest of your code.

______________________________________
Joe Kesselman  / IBM Research

Received on Wednesday, 1 March 2000 10:56:43 UTC