Introducing MochiKit - MochiKit.Selector and More
(Page 4 of 4 )
MochiKit.Selector provides a set of utilities used to select elements by CSS selector syntax, so you can easily select elements based on attribute, attribute value, whether they are descendants of a particular element and many more items as well as standard selecting by tag name. This was originally ported in from Python, but has evolved since then.
The MochiKit.Signal module makes easy work of event handling and replaces the browser's native event API completely. It allows you to connect to any type of event and takes care of deciding which event model to use, retrieving the event object and cleaning up afterwards.
MochiKit.Style allows you to easily manipulate element styles. You can get and set styles, element dimensions and element positions, play with the opacity of elements and show and hide elements, all with easy function calls.
MochiKit.Sortable lets you create lists that can be sorted via dragging and dropping the list items and is another module ported from Scriptaculous. The API for this module is very compact, with just three methods: one to create the sortable list which will normally be based on an unordered list, one to destroy the sortable object and one to serialize the object for sending to a server via XMLHttpRequest.
The final module is MochiKit.Visual. It provides a huge range of visually appealing, engaging effects such as scrolling and sliding elements, elements that fade in and out of view, elements that shrink or grow and much more. It also provides the excellent CSS manipulation for rounding the corners of elements. This is all done with JavaScript and CSS. It works very well in different browsers and is probably the easiest part of MochiKit to use.
ConclusionHow useful you find MochiKit will depend on your knowledge and experience of JavaScript. Some of the more basic tools can be used very easily by almost anyone, but the library is very different from some available libraries in that it doesn't give you a bunch of pre-packaged solutions to common web design problems; it's not a template library. The people that will get the most out of MochiKit are people that are constantly finding that JavaScript just doesn't have the built-in tools that they need and is constantly falling short of their expectations. The documentation is pretty technical, with few paint-by-numbers examples, but there's no doubt that this is a very powerful library in capable hands.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |