Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evilstreak/thinjs
A super-lightweight javascript library for when you just need something simple
https://github.com/evilstreak/thinjs
Last synced: about 2 months ago
JSON representation
A super-lightweight javascript library for when you just need something simple
- Host: GitHub
- URL: https://github.com/evilstreak/thinjs
- Owner: evilstreak
- Created: 2009-11-07T18:01:36.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2009-11-18T21:35:28.000Z (about 15 years ago)
- Last Synced: 2024-10-04T13:31:24.187Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 78.1 KB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-star - thinjs - lightweight javascript library for when you just need something simple | evilstreak | 19 | (JavaScript)
README
Thin JS - Super lightweight javascript library
==============================================## What does it do?
Thin JS is intentionally lightweight (**under 1KB** after minification in
fact). It lacks features because it's meant for use where you want to add a
little javascript to a site but not enough to include the 56k that [jQuery][]
weighs after minification. If you're doing enough stuff that the features of
Thin JS don't cut it for you then just man up and use a full library.## Selectors
Uses `document.querySelectorAll` to find elements which means it's
blistering fast with a tiny footprint, but only supports IE8, FF3.5, Safari
3.2+, Chrome (all versions) and Opera 10. Thin JS will fail silently in
other browsers.## Each
Use `$().each` by passing a function to be executed for each element in the
result set with `this` set to be the element in question.$( "p code" ).each( function() {
this.style.backgroundColor = "#d8fcce";
this.style.color = "green";
} );## Event binding
Bind events using `$().bind` by passing the event type to bind to and the
function to be bound.$( "h2" ).bind( "click", function() {
this.style.color = "#d11";
} );## Event delegation
Delegate events using `$().live` by passing the event type to bind to and the
function to be bound.$( "h2" ).live( "click", function() {
this.style.color = "#d11";
} );## DOM Ready
You can use `$.ready` to set functions to be executed once the DOM is ready.
[jQuery]: http://jquery.com