JQuery .find 有多个选择器

JQuery .find with multiple selectors

我遇到 Jquery 项的问题[c] 被明确定义为 HTMLElement 但是当我使用 .find 和多个选择器时我得到这个错误:

TypeError: X[g].exec is not a function
http://code.jquery.com/jquery-latest.min.js

当我检查一些手表时,我得到了下图中的内容:

$(items[c]).find('.received') 工作正常,returns 一些元素,因为 class

有一些元素

$(items[c]).find('.receive') 也可以正常工作,returns 零元素,因为 class.

没有元素

$(items[c]).find('.received.unseen') returns 未定义和错误。那么这里发生了什么?

编辑:这里是 items[c] 里面的内容,来自调试器 firefox

编辑: 这是我遇到错误的函数,我切换到 jquery 2.1.1:

function updateUnseenBell(){
    var m;
    for (var c in items)
        if (items.hasOwnProperty(c) && (m = items[c].gEbCN("chat-partner-tab")[0])) {
        if($(items[c]).find('.received.unseen:not(.shown)').length > 0){
            if (!(m.l2_newMsgBell)) {
                m.appendChild(m.l2_newMsgBell = newMsgBell.cloneNode());
                playSound("message");
            }
        } else if (m.l2_newMsgBell) {
            m.removeChild(m.l2_newMsgBell);
            delete m.l2_newMsgBell;
        }
    }
}

并且我将其降低到这个最小值以进行调试,但仍然出现相同的错误:

function updateUnseenBell(){
    for (var c in items) {
        if (items.hasOwnProperty(c)) {
            if ($(items[c]).find('.received.unseen:not(.shown)').length > 0) {
                alert(1);
            } else {
                alert(2);
            }
        }
    }
}

使用

$(items[c]).find('.message.received.unseen') 

这应该有效。

另一种解决方法是

$(items[c]).find(".received").find(".unseen").find(":not(.sh‌​own)")

这不是一种优雅的方法,但也很有效。