-
Notifications
You must be signed in to change notification settings - Fork 136
Description
First off – thanks, and great work on the Ender suite. This is a slick jQuery alternative.
I have noticed something I would consider an issue with Bonzo's implementation of the .closest() command within the Ender bridge. It appears that calling .closest() does not take the origin element into account as a potential selector target; it only appears to climb the tree from the origin. Take the following example...
HTML:
<a href="to.html">Click <b>Me</b></a>
JS (using Qwery, Bonzo & Bean):
$("a").on("click", function(evt) {
evt.preventDefault();
console.log( $(evt.target).closest("a") );
});In the above example, clicking on the "Click" portion of the anchor finds nothing, while clicking on the "Me" portion of the anchor successfully finds the parent anchor. This differs from the jQuery implementation, which would find the anchor in both cases. I find the jQuery implementation more intuitive, which includes the origin element as a potential candidate in the closest selector search. If I wanted to omit the origin and just search up the tree, I'd use .parents().