> $(selector).index(target) != -1 > > may cause performance issue? > > reglib recursively check event.target and its ancestor to know whether > it matches selector.
It depends on the selector. I'm pretty sure it depends on many factors. If you (f.e) click an element that is deeply nested in the dom, then recursing its ancestors will surely take a long time (proportionally of course). A simple selector is something relatively fast to process and just ONCE, not once for EACH ancestor. If you add to that, that Sizzle will have a cache when available... well.. even faster. I'm not saying this way is surely faster, just that the other approach is not straightly better, always. -- Ariel Flesler http://flesler.blogspot.com