3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js">/**
\r
10 * @class Ext.Element
\r
12 Ext.apply(Ext.Element.prototype, function() {
\r
13 var GETDOM = Ext.getDom,
\r
18 <div id="method-Ext.Element-insertSibling"></div>/**
\r
19 * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
\r
20 * @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
21 * @param {String} where (optional) 'before' or 'after' defaults to before
\r
22 * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
\r
23 * @return {Ext.Element} The inserted Element. If an array is passed, the last inserted element is returned.
\r
25 insertSibling: function(el, where, returnDom){
\r
28 isAfter = (where || 'before').toLowerCase() == 'after',
\r
31 if(Ext.isArray(el)){
\r
33 Ext.each(el, function(e) {
\r
34 rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom);
\r
44 if(el.nodeType || el.dom){
\r
45 rt = me.dom.parentNode.insertBefore(GETDOM(el), isAfter ? me.dom.nextSibling : me.dom);
\r
50 if (isAfter && !me.dom.nextSibling) {
\r
51 rt = DH.append(me.dom.parentNode, el, !returnDom);
\r
53 rt = DH[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
\r