Hey all, Experimental version ready in seperate branch, see below.
On Tue, Oct 7, 2008 at 19:11, Arnar Birgisson <[EMAIL PROTECTED]> wrote: >> Sounds good to me - would it be too hard to hook into Sizzle and add these >> ourselves so that the tests pass? I don't know squat about the current code >> and what is involved in doing this; would it be much work? > > I intend to find out tonight :) As it turns out, most of these were easy to implement. Sizzle actually pulls some implementation from jQuery if it is available. I copied and adapted the relevant parts from jQuery (which is also MIT licensed). Sizzle had a few bugs (or at least incorrect behaviour imo) which were easy to fix, among those was support for the |= selector. I created a branch called selector_sizzle [1] and committed this there, ready for review - with the following notes: [1] http://svn.mochikit.com/mochikit/branches/selector_sizzle 1. All unit tests pass in FF except those for three types of selectors. As they were stopping the test suite I had to comment them out. The three selector types that do not work are: - :nth-of-type(...) This one is not supported by Sizzle, and it is not straight forward to do so. I think we should just accept that, they are CSS3 features and probably not used a lot. - a[someattribute] Now this is quite common, and I think that it is the intention of Sizzle to support this. However, the implementation is broken - I couldn't figure out what was wrong so I emailed John about it, I'm currently waiting for a reply. If nothing else, MochiKit should thus lead to one bugfix in Sizzle. :) My opinion here is to wait for John, either he fixes it or helps me to do it. - :root This selector is also from CSS3 and is not supported by Sizzle. I think it is possible, I tried adding support for it but it didn't work out too nicely. This has to do with the fact that Sizzle assumes one is working with "document" (the main doc) but MochiKit.Selector, and thus the unit test for :root, tries to use this on other documents with the functionality in MochiKit.DOM (withDocument, currentDocument etc.). My opinion is that we should simply skip this as well. 2. The change in the branch introduces a few global names. Namely: chunker, cache, Sizzle, Expr, makeArray, dir, dirNode, dirCheck. This is a bit messy since many of these names are non-distinct and could be used by users or other libraries. We should probably enclose them somehow in the MochiKit.Selector namespace. However, I will suggest to John that Sizzle only binds one global name (Sizzle) and tucks the others away in that namespace. Some unit tests fail on Safari, will have to look at that tomorrow (unless someone else wants to give it a go). Please run the unit tests on other platforms and browsers as I only have access to FF3 and Safari 3. My speed measures, using the SlickSpeed framework, indicate a 55x speedup - going from 3.9 sec with the old Selector module to 71 ms for the new Sizzle based one. The SlickSpeed benchmark tests many selectors, but far from all of them (i.e. it does not has enough coverage to be a unit test). Please run the benchmark on your browser if you like, just visit [2] and everything should be set up already. [2] http://www.hvergi.net/arnar/public/sizzle/speed/# So.. please try this out and comment. What changes do you think are necessary (if any), including my suggestions above, before comitting this to trunk? cheers, Arnar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---
