kassens / slick forked from subtleGradient/slick

slick CSS selectors for javascript—now triple teh aswome

This URL has Read+Write access

Thu Nov 05 15:02:27 -0800 2009
commit  f05309dd43cf63d4ef16b8e27f8ef2704da79665
tree    e95bb3d997059ff4ca306e061d9e484d807a4bba
parent  067883c647fdf73832465e4a6ba1e43a3d0c8b59
slick /
name age message
file .gitignore Sat Oct 10 16:08:55 -0700 2009 ignore the textmate project file [subtleGradient]
directory 3rd-party-tests/ Mon Aug 17 14:12:32 -0700 2009 slick => Slick [appden]
file README.md Tue Sep 15 10:21:43 -0700 2009 tweaked object format doc [subtleGradient]
file slick.js Loading commit data...
file slick.tmproj Sun Jun 14 20:43:46 -0700 2009 ... [subtleGradient]
directory speed/
directory test/
README.md

MooTools Slick Selector Engine

A new standalone selector engine that is totally slick!

Create your own custom pseudo-classes!

Ever want to make your own :my-widget(rocks) pseudoclass? Now you can!

Use your own custom getAttribute code!

EG: Use MooTool's Element.get method or jQuery's $.attr

Use your own parser!

Want to support XPATH selectors? JSONPath selectors? Pre-cached JS Object selctors? Just swap out the default parser and make your own.

Use the parser by itself!

Want to integrate a CSS3 Selector parser into your own app somehow? Use the slick selector CSS3 parser by itself and get a JS Object representation of your selector.

MooTools Slick CSS Selector Parser

Parse a CSS selector string into a JavaScript object

Object format

{
    Slick: true,
    reverse: function(){},
    simple: false,
    length: 1,
    raw: "tag#id.class[attrib][attrib=attribvalue]:pseudo:pseudo(pseudovalue):not(pseudovalue)",
    expressions: [
        [
            {
                parts: [
                    { type: "class",                    value: "class", regexp: /regexp/ },
                    { type: "attribute", key: "attrib",                                      test: function(){} },
                    { type: "attribute", key: "attrib", value: "attribvalue", operator: "=", test: function(){} },
                    { type: "pseudo",    key: "pseudo" },
                    { type: "pseudo",    key: "pseudo", value: "pseudovalue" },
                    { type: "pseudo",    key: "not"   , value: "pseudovalue" }
                ],
                tag: "tag",
                id: "id",
                classes: [
                    "class"
                ],
                attributes: [
                    { type: "attribute", key: "attrib", value: "",                           test: function(){} },
                    { type: "attribute", key: "attrib", value: "attribvalue", operator: "=", test: function(){} }
                ],
                pseudos: [
                    { type: "pseudo", key: "pseudo" },
                    { type: "pseudo", key: "pseudo", value: "pseudovalue" },
                    { type: "pseudo", key: "not",    value: "pseudovalue" }
                ],
                combinator: " "
            }
        ]
    ]
}