Skip to content

djjeon/seek

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SEEK

Seek is a pure-JavaScript CSS selector engine using browser native API. We used native API to make it lightweight. It provide a convenience to find elements for manipulation.

  • querySelectorAll
  • getElementById
  • getElementsByTagName
  • getElementsByClassName

Browser Supports

A browers must support the native function of 'querySelectorAll'.

As such, the following browser supporte:

  • Chrome 16+
  • Edge 12+
  • Firefox 3.6+
  • Internet Explorer 9+

API

  seek( String selector [, DOMNode context [, Array result]] )

The main function for finding elements. use 'querySelectorAll'.

Parameters

  • selector: A CSS selector.

  • context: An element, document, or document fragment to use as the context for finding elements.

    ( Defaults : window.document )

  • result: An array.

Return

  • returns: All elements matching the selector.

Selector

seek supports CSS3 Selector and some functional selector. And results returned in document order.

As such, the following pseudo-selectors are not supported:

  • :hover
  • :active
  • :visit, :link

As such, the follwing functional selector:

  • :first/:last : the first/last matching element.
  • :even/:odd : Even/odd-numbered elements.
  • :eq(NUMBER)/:nth(NUMBER) : the nth element. ':eq(1)' finds the second element.
  • :lt(NUMBER)/:gt(NUMBER) : Elements at positions above/below the specified position.
  • :contains(TEXT) : Elements with textContent containing the word 'TEXT'.

Example

// Finds odd table rows.
var elems = seek(  "#content-table tr:odd"  )

Testing

Open the test/index.html on a web browser.

LICENSE

GNU Lesser General Public License version 2.1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 89.6%
  • HTML 7.3%
  • CSS 3.1%