Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mootools/slick

Standalone CSS Selector Parser and Engine. An official MooTools project.
https://github.com/mootools/slick

Last synced: 3 months ago
JSON representation

Standalone CSS Selector Parser and Engine. An official MooTools project.

Awesome Lists containing this project

README

        

(Slick is an official [MooTools](http://mootools.net) project)

Slick
=====
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.

---

Slick Selector Engine
=====================

Usage
-----

### `search` context for selector
Search this context for any nodes that match this selector.

Expects:
* context: document or node or array of documents or nodes
* selector: String or SelectorObject
* (**optional**) append: Array or Object with a push method

Returns: append argument or Array of 0 or more nodes

Slick.search(document, "#foo > bar.baz") → [, , ]
Slick.search([

    ,