Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!$('nothing').eq(0) is true, and !!$('nothing')[0] is false #75

Open
vvenv opened this issue Apr 17, 2014 · 0 comments
Open

!!$('nothing').eq(0) is true, and !!$('nothing')[0] is false #75

vvenv opened this issue Apr 17, 2014 · 0 comments

Comments

@vvenv
Copy link

vvenv commented Apr 17, 2014

以下代码,!!element,总是返回 true,建议的解决是 var element = $(selector)[0] 或采用length判断

 Widget.query = function(selector) {
    var element = $(selector).eq(0)
    var cid

    element && (cid = element.attr(DATA_WIDGET_CID))
    return cachedInstances[cid]
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant