After some more testing there seems to be some issues with this approach as it fails if you have a selector like this: input[name=".types["] If the value contains a dot and an opening bracket then the class selector regex will match the string after the dot.
Also it won't match .foo in this expression: .foo #bar\] I guess the second one can be fixed somehow but the first one seems to be pretty hard to resolve -- at least for me :) Cheers, Balazs On Jan 4, 12:08 am, "John Resig" <jere...@gmail.com> wrote: > This should be fixed now. Thanks for the tips, > Balazs!http://github.com/jeresig/sizzle/commit/c757d135949d0a4b15a9fd6d72907... > > --John > > On Sat, Jan 3, 2009 at 10:35 AM, Balazs Endresz > > <balazs.endr...@gmail.com> wrote: > > > Hi, > > a couple of months ago I made little patch to Sizzle > >http://groups.google.com/group/jquery-dev/browse_thread/thread/d74e5a... > > to enable selection by data and css properties inside an attribute > > selector: > >http://jsbin.com/otoqo/edit > > > It uses a negative lookahead to prevent other selectors to match > > inside square brackets, so it "accidentally" fixes some of the bugs > > reported here. But the interesting thing is that I ran a few > > Slickspeed tests to see its impact on speed and quite surprisingly it > > turned out to be even 1-2% faster on FF3 and in IE7 the difference is > > below 1 percent. I only tested with 1.3b1 and it passes all the jQuery > > selector tests as well! > > > On Jan 3, 3:25 pm, "John Resig" <jere...@gmail.com> wrote: > >> The primary issue is that Sizzle randomly grabs portions of a selector > >> in a specific order. This helps to improve speed but it harms complex > >> cases like this. I'm working on a patch to resolve it. > > >> --John > > >> On Sat, Jan 3, 2009 at 12:56 AM, chuyeow <chuy...@gmail.com> wrote: > > >> > Hi Olaf, > > >> > This bug has been reported before but there is no patch for it yet. > > >> > So far I've been able to narrow it down to selectors with periods in > >> > them being incorrectly recognized as a class selector, but do not have > >> > enough regex-fu to know how to solve the bug yet. > > >> > The class selector regex in Sizzle: /\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/ > > >> > Running this regex against "a[href$='.jpg']" (or any similar non-class > >> > selector with a period in them): > >> > "a[href$='.jpg/']".match(/\.((?:[\w\u0128-\uFFFF_-]|\\.)+)/) > >> > => returns matches = [.jpg, jpg] which is wrong > > >> > Hopefully this helps anyone also looking at the bug. > > >> > Cheers, > >> > Chu Yeow > > >> > On Dec 30 2008, 8:19 pm, Olaf <olaf.bo...@t-online.de> wrote: > >> >> Hi, I test 1.3.b1 and this Selector work any more: > > >> >> <script type="text/javascript"> > >> >> //<![CDATA[ > >> >> $(document).ready(function() { > >> >> // no more with 1.3b1 > >> >> // $("#content a[href$='.jpg']").lightBox(); > >> >> $("#content a").lightBox();}); > > >> >> //]]> > >> >> </script> > > >> >> What is to do? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---