https://github.com/zackify/legit.js
a lightweight javascript framework for modifying the DOM / CSS
https://github.com/zackify/legit.js
Last synced: 12 months ago
JSON representation
a lightweight javascript framework for modifying the DOM / CSS
- Host: GitHub
- URL: https://github.com/zackify/legit.js
- Owner: zackify
- Created: 2014-05-22T23:25:16.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-12-23T20:16:20.000Z (about 11 years ago)
- Last Synced: 2025-03-17T08:21:28.390Z (12 months ago)
- Language: JavaScript
- Homepage: http://zackify.github.io/legit.js/
- Size: 190 KB
- Stars: 6
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
legit.js
=========
Legit.js is meant to be an extremely lightweight library for manipulating the DOM, handling events, and a few other miscellaneous functions that are commonly used. The point of legit is to stay under 5K, which is a hard goal to keep.
- Handles only the things you always need
- Easily extended
Click Events
----
All native click events (see [here](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onabort)) work with legit. Our event system works similar to jQuery:
```
_('div').on('click', function(event){
console.log(event);
});
```
Tips
-----------
Most functions called returns an instance of legit.js except for when you call certain ones, like .html(), which will return a value instead. This means calling anything other than these special functions lets you chain calls. You can do:
```
_('div').parent().children(1).css('background-color','black').attr('name','value')
```
Obviously, doing .parent and then .child is pretty pointless, but you get the idea!
When using something like .attr(), if you only pass in a name and not the value, it will return the current value.