After debugging the code through jQuery code, when it is run, this turns out to be a problem with how the jQuery() method is() used in the is() method. As you know, you can pass a context to a method , and internally this context is used with the is() method (and differently for different selectors).
When $(e.currentTarget) , the context is set to the button that triggers the event. If $('button') , the context is set to the Document object. This makes sense when you think about how these selectors should be covered.
Here is the relevant part of the is() method:
jQuery( selector, this.context ).index( this[0] ) >= 0
Based on this, when launched as $ (e.currentTarget), the jQuery() method call is evaluated as follows:
jQuery("li:first", "button#bam").index( this[0] ) >= 0
Obviously, it returns -1 and reports false
source share