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

On Mon, Nov 21, 2011 at 8:54 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> You're not misunderstanding, but you're wrong.  ^_^  The element
> itself is put in the lookup chain before document.  See this testcase:
>
> <!DOCTYPE html>
> <button onclick="alert(namespaceURI)">foo</button>
>
> (namespaceURI was the first property I could think of that's on
> Element but not Document.)

Awesome.  It seems on* is even more pathological than I realized.  So
definitely, I don't think we want to avoid adding short names to Node
or Element or Document forever just because of this.  If the cost is
making bare name lookup in on* slightly more pathological than it
already is, I don't think that's a big deal.  Authors who want to
preserve their sanity should already be prefixing everything with
"window." or "document." or whatever is appropriate.  Let's add
.matches() and just make it not triggered as a bare name from on*.

Received on Tuesday, 22 November 2011 02:01:46 UTC