3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
15 * @class Ext.Element
\r
17 Ext.apply(Ext.Element.prototype, function() {
\r
18 var GETDOM = Ext.getDom,
\r
23 <div id="method-Ext.Element-insertSibling"></div>/**
\r
24 * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
\r
25 * @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.
\r
26 * @param {String} where (optional) 'before' or 'after' defaults to before
\r
27 * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
\r
28 * @return {Ext.Element} the inserted Element
\r
30 insertSibling: function(el, where, returnDom){
\r
34 if(Ext.isArray(el)){
\r
35 Ext.each(el, function(e) {
\r
36 rt = me.insertSibling(e, where, returnDom);
\r
41 where = (where || 'before').toLowerCase();
\r
44 if(el.nodeType || el.dom){
\r
45 rt = me.dom.parentNode.insertBefore(GETDOM(el), where == 'before' ? me.dom : me.dom.nextSibling);
\r
50 if (where == 'after' && !me.dom.nextSibling) {
\r
51 rt = DH.append(me.dom.parentNode, el, !returnDom);
\r
53 rt = DH[where == 'after' ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
\r