Hello everybody,

I'm pretty confident with using jQuery but now I'd like to improve my
understanding of the librarie's code itself.
I sometime see an alternative way of writing portions of code but I'm
pretty sure there is a good reason that it is the way it is... I would
just like to understand.

1. The function hasClass is written this way:
hasClass: function( selector ) {
        return !!selector && this.is( "." + selector );
},

Why not simply testing the className against the selector:
return !!selector && (" " + this.className + " ").indexOf(" " +
selector + " ") != -1;

2. In sizzle, many regular expressions for the selectors include:
((?:[\w\u00c0-\uFFFF_-]|\\.)+)

Why is "_" added to the pattern? Isn't it already included in "\w"?
And what is "|\\." for?

Thank you for your attention, I'm pretty sure I will have more of
these questions in the future.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to