> 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; >
Actually, this was one change that we were slated to make for jQuery 1.3.3 (along with getting rid of the internal jQuery.className.has method). > > 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? > Yep, _ is redundant. Can you file a ticket? http://dev.jquery.com/newticket |\\. is for detecting cases where someone escapes a character in a selector, like so: $("#foo\\:bar") to find something with id="foo:bar" --John --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---