scan

querySelectorAll selector engine

npm install scan
35 downloads in the last week
46 downloads in the last month

scan

scan is a querySelectorAll-based selector engine designed for standalone use or integration into jQuery-like libraries like ender.

npm: scan

API (0.7)

scan()

scan(query, context?)

  • scan(selector) → elements that match selector
  • scan(selector, node|nodes) → elements that match selector from node or any nodes
  • scan(node|nodes) → array

.matches()

scan.matches(element, selector) → boolean

.contains()

scan.contains(haystack, needle, start?) → boolean

  • scan.contains(node, element)true if node contains element
  • scan.contains(stack, item, start?)true if stack contains item
  • scan.contains(str, substr, start?)true if str contains substr

.find()

scan.find(query, context?)

scan.find(stack, fn, scope?)

.find(needle)

  • scan.fn.find.call(nodes, selector) → descendants that match selector
  • scan.fn.find.call(nodes, element|elements)elements that descend from any nodes
  • scan.fn.find.call(stack, fn, scope?) → same as scan.find(stack, fn, scope?)

.filter()

.filter(needle)

  • scan.fn.filter.call(nodes, selector)nodes filtered by selector
  • scan.fn.filter.call(nodes, fn)nodes filtered by fn.call(node, i)
  • scan.fn.filter.call(nodes, element|elements)nodes filtered by element|elements

.not()

.not(needle)

  • scan.fn.filter.call(nodes, selector)nodes filtered against selector
  • scan.fn.filter.call(nodes, fn)nodes filtered against fn.call(node, i)
  • scan.fn.filter.call(nodes, element|elements)nodes filtered against element|elements

Support

Selector queries use querySelectorAll where available or else degrade to getElementsByTagName.

Developers

Contribute by making edits in /src or reporting issues.

$ npm install
$ grunt jshint:src

Fund

Tip the developer =)

License

MIT

npm loves you