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