JSquared

JSquared is a light-weight and light-touch JavaScript library aimed at more experienced web development professionals. JSquared makes web development easier and faster by allowing you to focus on the features of your application rather than the vagaries of the web browser.

https://github.com/wolffe/JSquared

No $?

Unlike JavaScript libraries such as jQuery, Mootools and Prototype, there is no $ function. JSquared uses standard DOM methods, so you can start using JSquared without changing your existing code.

AJAX

JSquared is bundled with a set of tools to make building rich internet applications using AJAX easier and faster including an AJAX request handler, browser history manager and more.

Size

The full DOM manipulation library, a full events library, FXSquared (the effects library), AJAX library, browser history manager and all the other tools is approximately 13Kb minified and Gzipped.

Highlights

  • Simple node selection and DOM traversal
  • Powerful and flexible events model
  • Cross browser DOM event enhancements
  • Simple AJAX and ADIJ objects for making asynchronous requests
  • Powerful effects and animations capabilities
  • Browser history manager
  • Plugin architecture

QUICK START

JSquared is a light-weight and light-touch JavaScript library. This is a quick start user guide which should get you going with JSquared.

Much more information can be found in the documentation.

ELEMENT TOOLS

The core to the JSquared library are the element tools. The element tools are added to each DOM node that is retrieved via a JSquared enhanced method or any other element tool. The list of element tools supplied with the library can be found in the J2.Element.Tools object.

The standard DOM methods that will bind the element tools to the node or nodes returned can all be found in the J2.Core.newDOMMethods object. These methods and the other methods in the element tools which return DOM nodes will bind the element tools to each node returned:

  • getElementById
  • getElementsByTagName
  • getElementsByTagNames
  • getElementsByClassName
  • getParent
  • getParentByStyle
  • getNextSibling
  • getPreviousSibling
  • appendChild
  • replaceChild
  • replace
  • insert
  • insertBefore
  • insertAfter
  • createElement

Element tools are called directly on the node, eg:
document.getElementById(“myElement”).elementTool();

ADDING ELEMENT TOOLS

JSquared comes with a wide array of element tools. However, you may wish to add further element tools. You can do this via the method J2.Core.addElementTool. JSquared will keep track of all nodes which have had the element tools bound to them and when an element tool is added using this method, all currently bound nodes and any future nodes bound will gain this additional tool.

Changelog

JSQUARED 2.1

  • DOM Events – Manually firing a DOM event will now cause the event to bubble as per when the browser fires it
  • JSquared will clean up the global scope after itself leaving minimum footprint
  • Fixed bugs with custom events where adjusting listeners while the event is firing will cause failures next time the event is fired
  • Complete rewrite of effects and animations. Simplified syntax, improved performance
  • Added chaining for animations
  • Added wait method to cause a chain of animations to run in a sequence
  • Added pause, play and stop methods for animations
  • Callback from animations run in the scope of the original firing element

JSQUARED 2.0

  • All deprecated methods and properties removed
  • DOMContentLoaded – fixed bugs and made more compatible and performant
  • getElementsByClassName – fixed for Firefox 3
  • Element tools are now bound to and available on the body node
  • Added replace element tool
  • Added moveTo element tool
  • Added insert element tool
  • Added contains element tool
  • Changed TabSet handling to be an element tool
  • Added mouseenter and mouseleave events
  • Improved memory handling for DOM events
  • Event handler – ability to add context to all handlers. Improved performance
  • Added J2.Window object with methods for getting the size of the window
  • Added extension to String object – unDelimit
  • Changed J2.QueryString to use unDelimit method and be a static object
  • AutoFilter object – added updateData method
  • URL – updates to browser history manager to only initialise when required
  • URL – bug fixes to ensure browser history manager works as expected
  • FXSquared – released version 2.0 with bug fixes from version 1.0 beta

JSQUARED 1.1

  • CSS Color – new object for passing colours between methods
  • DOMContentLoaded – more reliable DOM Content Loaded handling
  • Element bindings – new more performant bindings including various bug fixes
  • Event handling – new custom event handling and more reliable DOM event handling
  • getElementsByClassName – much faster and now fully cross browser using native methods
  • setStyle and getStyle – more compatable, performant and accurate methods
  • ADIJ-P – support for the JSON-P standard with the ADIJ object
  • J2Cookie – bug fixes
  • J2Cache – new caching object
  • FXSquared beta 1 – new effects and animations plugin