Code Monkey home page Code Monkey logo

domtastic's Introduction

DOMtastic

Small & fast DOM and event library for modern browsers. Having the same familiar API as jQuery (but without the extra "weight" of modules like $.ajax, $.animate, and $.Deferred), it works great stand-alone or paired up with e.g. Backbone or Angular. The library is only 3-4KB (min+gzip), and it's easy to create a custom build to exclude parts you don't need.

The source is written using ES6 features, and transpiled to AMD and CommonJS with Traceur. Browserify is used to create a UMD bundle (supporting AMD, CommonJS, and fallback to browser global).

This library was recently renamed from "jQuery Evergreen".

Quicklinks

Build Status Coverage Status Selenium Test Status

Quickstart

CommonJS

# Install
npm install domtastic

# Use
var $ = require('domtastic');

AMD

# Install
bower install domtastic

# Configure
paths: {
	'domtastic': 'bower_components/domtastic/domtastic'
}

# Use
define(['domtastic'], function($) {
	$('.earth').addClass('evergreen').on('sunrise', '.people', awake);
});

Browser Global

# Configure
<script src="//cdn.jsdelivr.net/domtastic/latest/domtastic.min.js"></script>

# Use
$('.planet').addClass('evergreen').on('sunrise', '.grass', grow);

API

every
filter
forEach
indexOf
map
pop
push
reverse
shift
some
unshift
attr
removeAttr
addClass
removeClass
toggleClass
hasClass
after
append
before
clone
prepend
on
off
delegate (deprecated, will be removed soon)
undelegate (deprecated, will be removed soon)
trigger
triggerHandler
ready
html
noConflict
$
find

API (bare)

The pre-built "bare" package does not include the attr, data, and html modules.

API (full)

The pre-built "full" package also includes the following modules:

appendTo
empty
remove
replaceWith
text
val
isNative
native
children
contents
closest
eq
get
parent
slice

But it doesn't even have ...!

As mentioned in the introduction, DOMtastic doesn't have methods for your Ajax, Animation and Deferred needs. Please find your own libraries to fill in the gaps as needed. Here are just some examples:

However, feel free to open an issue if you feel an important method is missing.

Browser Support

Selenium Test Status

Latest versions of Chrome, Firefox, Safari, Opera, Chrome Mobile iOS, and Mobile Safari. IE10 and IE11. IE9 only needs a polyfill for classList to make these tests pass.

Performance

Run the benchmark suite to compare the performance of various methods of jQuery, Zepto and DOMtastic.

Native Mode

You can opt-in to work directly with Node and live NodeList objects, as opposed to the default, wrapped $ object.

Custom Build

git clone [email protected]:webpro/DOMtastic.git
cd DOMtastic
npm install
gulp --exclude=attr,mode,html

And find the output in the dist/ folder.

Test

Run the test suite. You can also clone/fork the sources from Github and run tests locally.

Credits

Many thanks to these sources of inspiration:

Thanks to jsDelivr for hosting DOMtastic.

License

MIT licensed

Analytics

domtastic's People

Contributors

webpro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.