Re: [selectors-api] What DOM feature "Selectors API" belongs to?

On Thu, 10 Jul 2008 08:10:09 +0200, Lachlan Hunt <lachlan.hunt@lachy.id.au> wrote:
> 
> Kartikaya Gupta wrote:
> > Speaking as an implementor in Java, I would like to see a feature 
> > string defined. I can't provide any evidence that people use feature 
> > strings now
> 
> Do you use hasFeature() to detect the presence of any other DOM APIs? 
> If so, when and why?
> 

We use feature strings to detect whether or not the DOM implementation supports creating/dispatching certain types of (custom) events. This allows a decoupling of code that uses the DOM with the DOM implementation itself, and allows for independently upgradable components. Some parts of the code also require additional DOM functionality beyond what is provided by the standard APIs. This is exposed via additional interfaces on various DOM objects and feature strings are used to ensure that the DOM provides implementations of these interfaces. Again, this is largely to achieve modularity; it allows the "external" code to be maintained separately rather than tying it to our specific DOM implementation. Hypothetically speaking, if we were to implement something like Gears in Java, it would also be using feature strings extensively to detect the presence or absence of various features.

Received on Thursday, 10 July 2008 14:01:16 UTC