jQuery bug?

by garnwraly

HTML

<ul>
    <li class="apple"><button>click</button></li>
    <li class="orange">
        <button>this one doesn't work right</button>
    </li>
    <li class="orange">
        <button>click</button>
    </li>

JavaScript

$('body').on('click', 'button', function (e) {
    if($(e.currentTarget).parent().is('.orange:first')){
        alert('first orange!'); //this line never gets run
    }
    console.log($(e.currentTarget).parent().is('.orange:first')) //false
    console.log($('.orange button').first().parent().is('.orange:first')); //true
    console.log($($('.orange button')[0]).parent().is('.orange:first')); //false
});