Giter Club home page Giter Club logo

dollardom's Introduction

$dom

5k Javascript library for selecting, styling, traversing and animating DOM elements.

$dom was coded by Keith Clark and was once available at http://www.keithclark.co.uk/$dom/.

FAQ

Which version to download ?

dollardom.js is always the most up to date version. I consider that is is pretty good quality, which means that I still find bugs myself, but that I feel it can be used on real web sites or web applications. Please report any bug you find.

I'll try to keep dollardom.min.js (minified with uglifyjs) in sync but take attention to the timestamp to be sure.

If you want animation support, include either both dollardom.js and animate.js or their concatened/minified version dollardom-animate.min.js. Please note however that nowadays, you should consider doing simple animations with CSS transitions. For your more complex needs you can also have a look to SVG.

If you want try the new jQuery-like simpler chaining API, you can use dollardom-chain.min.js or dollardom-chain-animate.min.js instead. Since it is newer than the normal API, it could have some bugs. Please consider this syntax beta-quality.

A debug version is also available: dollardom-full.debug.js. Using this version during development makes you certain you use dollardom correctly, because otherwise you'll get exceptions. Please note that this version is not yet finished and some $dom functions are not checked yet.

Why ?

I used $dom in a project and wanted to fix one bug. Moreover Keith Clark stopped maintaining this code and I felt it is still useful nowadays.

I asked him where I could find the original source code (since only the minified/obfuscated code was available on his website) and he kindly sent it to me.

Why $dom ? There are lots of other very good libraries outthere

That's right. For big projects, you can use jQuery, Dojo, ExtJS, Mootools, etc. For mobile projects, there are jQuery Mobile, jqtouch, Sencha touch, Zepto.js, xui.js. But please read further.

Strong points

$dom features the following strong points:

  • it's small: 2.3 kB for the minified/gzipped version (compare with jQuery's size: 30kB)
  • it's general: it's not mobile-only or desktop-only. It's perfect for mobile-first or responsive design, which should run on a variety of very different devices.
  • it's compatible with all javascript-enabled browsers in use nowadays, even Internet Explorer 6. If you find a problem in such a browser, then it is a bug, please report it.
  • the syntax is clean. Compare:
$("<div id='myDiv' class='class1 class2'>"); // jQuery

with

    $dom.create("div#myDiv.class1.class2"); // $dom.
  • it doesn't include the features you don't need, e.g. Array iteration functions (forEach, map, reduce, etc.) or Ajax. There are perfectly good polyfills outthere.
  • Good documentation
  • Permissive BSD-like license
  • the author knows Javascript and the DOM (or I think so ;-) ).
  • there is a debugging version to help you use the library correctly.

Weak points

It has also of course some weak points, because we can't have it all:

  • it is certainly slower than alternatives like jQuery. However, on real websites, we should never have 10000 nodes. If you have, then this is not the right tool. We will never support such use cases.
  • it can't animate to relative value units like em.
  • the syntax is not jQuery-compatible, which means you have to learn a new syntax. I suggest you have a look to the $dom chaining API which is cleaner and simpler than the legacy API.

Is there an alternative ?

ender.js could be a good alternative with its modular approach. One of our goals is to integrate better with this tool.

Development notes

The build script needs uglifyjs and node.

On Debian-like systems, these could most probably be installed with the command :

aptitude install libnode-uglify

TODO

  • write more tests
  • document the chaining API
  • write more examples
  • make transform queueable
  • support attribute selector
  • add more assertion to the debug version
  • add the files to integrate with ender.

dollardom's People

Contributors

julienw avatar

Watchers

 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.