Hi Nathan, Are you sure it is a good idea to use RegExps for something as complex as CSS3 selectors? I haven't done any tests, but once you stumble upon a bug it's going to be tricky to fix.
I haven't build my selector engine yet, but if I were I would follow the path of parser-lib library: https://github.com/nzakas/parser-lib/blob/master/src/css/Parser.js which uses proper tokenizer. On Sun, Oct 2, 2011 at 11:40 PM, nathanJsweet <[email protected]> wrote: > Hey all, > I just posted a blog post on how to parse a css selector as part of a > series I'm doing on building a selector engine. I would recommend you > watch it only if you're a beginner or intermediate developer (advanced > developers will likely not learn anything new). It can be found at > http://nathansweet.me/selector-engine-css-parsing. Somewhat related, > the code for the selector engine that I built for this blog series I'm > doing can be found on my github account at > https://github.com/nathanjsweet/Punch. > If anybody is interested in offering me a review I would appreciate > it, but I by no means expect it for the following reasons: 1. The code > will never see the light of day, it was purely an academic exercise 2. > It is incomplete and will remain so (it doesn't fully mimic the full > range of possible selectors) 3. It doesn't take querySelector into > account 4. It takes very few cross-browser bugs into account. For what > is there though, I would be interested in somebody's opinion. Finally, > I've updated a test suite for selectors for this project that can be > found at http://nathansweet.me/queryselectorall-rundown. I will be > continually updating that page. Thanks in advance. > -Nate > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
