Rob Kinyon - DOM.Insert-0.02
NAME
DOM.Insert.Before
DESCRIPTION
This provides an easy way to add arbitrary HTML before a given element in the DOM.
CLASSES
DOM.Insert.Before
This takes in its constructor an element and content to be inserted. It will insert the content immediately before the element, as a sibling under the same parent.
// Assume someElement is a <LI>
new DOM.Insert.Before( someElement, '<li id=4>Value</li>' );
SUPPORT
Currently, there is no mailing list or IRC channel. Please send bug reports and patches to the author.
AUTHOR
Rob Kinyon (rob.kinyon@iinteractive.com)
Originally written by Sam Stephenson (sam@conio.net)
My time is generously donated by Infinity Interactive, Inc. http://www.iinteractive.com
/* */ try { JSAN.use( 'DOM.Insert' ); } catch (e) { throw "DOM.Insert.Before requires JSAN to be loaded"; } /* */ DOM.Insert.Before = Class.subclass( 'DOM.Insert.Before', DOM.Insert, { adjacency: 'beforeBegin' ,initializeRange: function() { this.range.setStartBefore( this.element ); } ,insertContent: function() { this.element.parentNode.insertBefore( this.fragment, this.element ); } }); /* */