(for modern browsers and ie10+)
microbe is a javascript library to aid in DOM manipulation aimed at speed and consistency as well as facilitating events, and data binding. It uses the micro character ( µ ) that is accessible in:
- osx: alt + m
- windows: alt + 0181
- linux: alt gr + m or alt + 230
microbe aims to be modular and expandable. It’s separated into several modules:
-
Selector engine with CSS4 selector support and base functions (find, filter, siblings, children, … )
-
Core helpers (class, extend, text, attributes … )
-
DOM helpers (append, appendTo, insertAfter, prepend … )
-
Type helpers(isUnidentified, isArray, isWindow, … )
-
HTTP helpers making use of Promises (get, post, … )
-
Data that is retrievable through the DOM. (get/set)
-
Events - binding and emitting custom events
-
See the full list in the docs
microbes are always array-like for consistency and can be extended and merged very easily.
Don’t hesitate to file issues and features requests! Or change things yourself and send a pull request.
-
npm i -D microbejs
or
-
bower install -S microbejs
or
-
<script src="./microbe.js"></script>
// all divs on the page
var µDivs = µ( 'div' ) ;
// create a div with the class example--class
var newDiv = µ( '<div.example--class>' );
// gives the class example--class to each div
µDivs.addClass( 'example--class' );
// all divs get a newDiv or a clone of newDiv inserted into the DOM after them
µDivs.insertAfter( newDiv );
// sets a custom event watch
µDivs.on( 'toTheMoon', function( e )
{
console.log( e.detail );
} );
// emits a custom event to all elements in µDivs with a custom data packet.
// triggers the event listener to show the sent data
µDivs.emit( 'toTheMoon', { moon : 'close' } );
- Clone repo
- Make sure node and npm is installed
npm install
npm build
From the command line:
npm run test
From the browser
http://m.icro.be/tests
http://localhost/microbe/tests
npm run build
builds all 4 standard microbe versions, then builds and runs testsnpm run buildTests
builds the testsnpm run deploy
bumps the minor version, runs build, then builds docsnpm run docs
builds the docs. rebuilds the docs everytime a file changesnpm run docsOnce
build docs oncenpm run gulp
builds microbenpm run http
builds microbe httpnpm run microbe
builds microbenpm run selectorEngine
builds the microbe selector enginenpm run toolkit
builds microbe toolkitnpm test
runs the test suite in nightmare
We gladly accept and review any pull-requests. Feel free! ❤️
Otherwise, if you just want to talk, we are very easy to get a hold of!
- Twitter: @microbejs
- Email: hello@m.icro.be
- Web: http://m.icro.be/
- Git: https://github.com/sociomantic-tsunami/microbe/
- IRC freenode #microbe
This project adheres to the Contributor Covenant. By participating, you are expected to honor this code.
Need to report something? report@m.icro.be
- added .value() and tests
- readme updates
- repo url update
- updated version_bump script
- observe is fully depreciated and removed
- observe related speed fixes in addClass, removeClass, attr, html, text, on, off, set, get
- all builds now have their own test page for testing encapsulation
- package.json cleaned up
- license spells
- added seperate http build
- gulp and package file changes
- fixed toolkit getter issue
- added bower to version_bump
- removed cdnjs-importer from dependencies
- small www changes
- automated version bumps to stop needing to jump multiple minor versions
- tweaked test css
- readme updates
- removed watch script from package.json
- fixed global constructor leak with pseudo
To keep the length of this file down, older changes are here