Re: [Selectors API 2] Is matchesSelector stable enough to unprefix in implementations?

On 11/21/11 8:31 PM, Aryeh Gregor wrote:
> The lookup chain is first document
> then window, with no elements anywhere, right?

The lookup order is the element the on* attribute is on, then the 
element's form if it's a form control (more or less; details are in the 
spec), then the document, then the window.  There are also some 
additional complications in terms of time-invariance of the lookup 
chain, etc, which most browsers agree on but a few do not.

> If this is a recurring problem

It is.

> could we consider implementing magic so that new methods on Document (or Node) that might cause problems
> are ignored in on* unless you prefix with "document."?

We could consider it; it would require that what goes on the scope chain 
of on* even handlers is some sort of proxy instead of the actual 
element/form/document/etc, I think...  That might work, though.  Would 
somewhat hurt performance for whatever code is inside the on* attribute 
itself (not including functions it calls), but that's usually not that 
much code, and already has a certain amount of overhead for the C++ to 
JS transition.  Maybe this is the way to go.

-Boris

Received on Tuesday, 22 November 2011 03:02:50 UTC