src/console/simpleyui.js
function(content, where) {
        var node = this._node;

        if (content) {
            if (typeof where === 'number') { // allow index
                where = this._node.childNodes[where];
            } else if (where && where._node) { // Node
                where = where._node;
            }

            if (typeof content !== 'string') { // allow Node or NodeList/Array instances
                if (content._node) { // Node
                    content = content._node;
                } else if (content._nodes || (!content.nodeType && content.length)) { // NodeList or Array
                    content = Y.all(content);
                    Y.each(content._nodes, function(n) {
                        Y_DOM.addHTML(node, n, where);
                    });

                    return this; // NOTE: early return
                }
            }
            Y_DOM.addHTML(node, content, where);
        } else  {
        }
        return this;
    }
function(content, where) {
        var node = this._node;

        if (content) {
            if (typeof where === 'number') { // allow index
                where = this._node.childNodes[where];
            } else if (where && where._node) { // Node
                where = where._node;
            }

            if (typeof content !== 'string') { // allow Node or NodeList/Array instances
                if (content._node) { // Node
                    content = content._node;
                } else if (content._nodes || (!content.nodeType && content.length)) { // NodeList or Array
                    content = Y.all(content);
                    Y.each(content._nodes, function(n) {
                        Y_DOM.addHTML(node, n, where);
                    });

                    return this; // NOTE: early return
                }
            }
            Y_DOM.addHTML(node, content, where);
        } else  {
        }
        return this;
    }
function ( content , where ) { var node = this . _node ; if ( content ) { if ( typeof where === 'number' ) { // allow index where = this . _node . childNodes [ where ] ; } else if ( where && where . _node ) { // Node where = where . _node ; } if ( typeof content !== 'string' ) { // allow Node or NodeList/Array instances if ( content . _node ) { // Node content = content . _node ; } else if ( content . _nodes || ( ! content . nodeType && content . length ) ) { // NodeList or Array content = Y . all ( content ) ; Y . each ( content . _nodes , function ( n ) { Y_DOM . addHTML ( node , n , where ) ; } ) ; return this ; // NOTE: early return } } Y_DOM . addHTML ( node , content , where ) ; } else { } return this ; }
Inserts the content before the reference node.
@method insert
@param {String | Y.Node | HTMLElement} content The content to insert
@param {Int | Y.Node | HTMLElement | String} where The position to insert at.
Possible "where" arguments
<dl>
<dt>Y.Node</dt>
<dd>The Node to insert before</dd>
<dt>HTMLElement</dt>
<dd>The element to insert before</dd>
<dt>Int</dt>
<dd>The index of the child element to insert before</dd>
<dt>"replace"</dt>
<dd>Replaces the existing HTML</dd>
<dt>"before"</dt>
<dd>Inserts before the existing HTML</dd>
<dt>"before"</dt>
<dd>Inserts content before the node</dd>
<dt>"after"</dt>
<dd>Inserts content after the node</dd>
</dl>
@chainable
Inserts the content before the reference node .