3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
10 Ext.apply(Ext.Element.prototype, function() {
11 var GETDOM = Ext.getDom,
17 * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
18 * @param {Mixed/Object/Array} el The id, element to insert or a DomHelper config to create and insert *or* an array of any of those.
19 * @param {String} where (optional) 'before' or 'after' defaults to before
20 * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
21 * @return {Ext.Element} The inserted Element. If an array is passed, the last inserted element is returned.
23 insertSibling: function(el, where, returnDom){
26 isAfter = (where || 'before').toLowerCase() == 'after',
31 Ext.each(el, function(e) {
32 rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom);
42 if(el.nodeType || el.dom){
43 rt = me.dom.parentNode.insertBefore(GETDOM(el), isAfter ? me.dom.nextSibling : me.dom);
48 if (isAfter && !me.dom.nextSibling) {
49 rt = DH.append(me.dom.parentNode, el, !returnDom);
51 rt = DH[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);