A micro JavaScript library used as a replacement for jQuery, weighing in under 5KB.
JavaScript HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist small fixes Mar 8, 2018
tests initial commit Apr 23, 2017
.gitignore initial commit Apr 23, 2017
LICENSE initial commit Apr 23, 2017
README.md Update jsDelivr links Sep 13, 2017
gulpfile.js initial commit Apr 23, 2017
index.html initial commit Apr 23, 2017
package-lock.json small fixes Mar 8, 2018
package.json small fixes Mar 8, 2018
selector.js added support for minWidth & minHeight Apr 9, 2018

README.md

Selector

A micro JavaScript library used as a replacement for jQuery, weighing in at nearly 5KB.

The aim of this project is to build a library that can be used to replace jQuery. The challenge will be to shrink the overall filesize of the library, keeping the minified, gzip compressed file under 5KB while simultaniously adding more support for jQuery features. The ultimate goal is to have a modern library that runs faster than jQuery under stress.

View Demo

Add to your project via public CDN from jsDelivr

https://cdn.jsdelivr.net/npm/selectorjs@0.9.12/dist/selector.min.js

File size comparison between jQuery and selector.js

Library Selector.js jQuery 3.2 jQuery 3.2 Slim
Uncompressed 68K 271K 217K
Minified 16K 84.5K 68K
Minified & Gzipped 4.8K 28.6K 22.7K

Supported jQuery selector functions

  • add
  • addClass
  • after
  • animate (requires Velocity.js)
  • append
  • attr
  • before
  • children
  • closest
  • css
  • each
  • empty
  • eq
  • filter
  • find
  • first
  • get
  • has
  • hasClass
  • height
  • hide
  • hover
  • html
  • index
  • innerHeight
  • innerWidth
  • is
  • last
  • map
  • next
  • not
  • off
  • offset
  • offsetParent
  • on
  • parent
  • parents
  • position
  • prepend
  • prev
  • prop
  • push (*pushStack)
  • ready
  • remove
  • removeAttr
  • removeClass
  • removeProp
  • serialize
  • show
  • siblings
  • slice
  • stop (requires Velocity.js)
  • toggle
  • toggleClass
  • val
  • width

Supported jQuery objects

  • $

Supported jQuery functions

  • $.ajax
  • $.extend

Unsupported jQuery functionality

  • jQuery object
  • All jQuery plugins
  • jQuery UI
  • jQuery.fx
  • Deprecated functions
  • More...

Disclaimer

This project is in beta and has been tested in Chrome 51+, IE8+ (using ie-shim.js), Safari 9+, and iOS 6+. Use at your own risk.

NOTES

  • *pushStack is now called push