Sean Hogan wrote:
Gregory Reimer (the author of reglib) points out that
Element.matchesSelector would be useful for event delegation.
See http://blogs.sun.com/greimer/entry/opera_10_will_suport_selector
It would also neatly tie in with NodeFilter in DOM-Traversal,
facilitating something like a live querySelectorAll() during document load.
It would be useful if you could elaborate upon those use cases.
Unfortunately I had assumed it was in the spec. I've looked now and seen
that it wasn't considered due to a lack of presented use cases, which
seems non-sensical.
How is that nonsensical? Without having use cases presented, it's hard
to justify the feature and even harder to make sure it's designed in the
most optimal way for those use cases.
The only reason for it not to be in the spec is if it is harmful.
AFAIK, no-one said it was harmful. It is too late for this proposal to
be added to this version of the spec, but it will be considered for the
next version.
The only complication I can see is supporting the :scope pseudo-attribute.
Assuming the CSSWG includes the :scope proposal in the next version of
Selectors, and if there are use cases for which :scope would be useful
in a matchesSelector() function, we can investigate solutions to address
the issue.
--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/