admin管理员组文章数量:1355684
here is the link to original code:
1) in th above code, what is $.expr[:]? 2) what is $.expr.createPseudo?
I can't find any document about it!!! Why they provide this without document? very frustrated!!!!!!!!!!!
here is the link to original code: http://css-tricks./snippets/jquery/make-jquery-contains-case-insensitive/#ment-518214
http://css-tricks./snippets/jquery/make-jquery-contains-case-insensitive/#ment-518214
1) in th above code, what is $.expr[:]? 2) what is $.expr.createPseudo?
I can't find any document about it!!! Why they provide this without document? very frustrated!!!!!!!!!!!
Share Improve this question asked Aug 18, 2013 at 2:23 Nicolas S.XuNicolas S.Xu 14.6k34 gold badges88 silver badges138 bronze badges 1- it is an internal function o jquery used to create jQuery expressions – Arun P Johny Commented Aug 18, 2013 at 2:26
2 Answers
Reset to default 71) in th above code, what is $.expr[:]? 2) what is $.expr.createPseudo?
It's how you extend Sizzle selectors. See the docs.
Sizzle is the DOM query engine used by jQuery.
$.expr
contains an object that holds reference to the sizzle pseudo selectors.
$.expr.createPseudo
is a method designed for extending the $.expr
object so you can implement new pseudo selectors.
For example,
$.expr[':'].wide = $.expr.createPseudo(function () {
return function (elem) {
return $(elem).width() > $(elem).height();
}
});
Here's a jsFiddle
Here's the github for sizzle docs
本文标签: what is exprquotquot in javascript or jQueryStack Overflow
版权声明:本文标题:what is $.expr[":"] in javascript or jQuery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743951810a2567429.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论