3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">/**
\r
11 Ext.apply(Ext.Element.prototype, function() {
\r
12 var GETDOM = Ext.getDom,
\r
17 <div id="method-Ext.Element-insertSibling"></div>/**
\r
18 * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
\r
19 * @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
20 * @param {String} where (optional) 'before' or 'after' defaults to before
\r
21 * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
\r
22 * @return {Ext.Element} the inserted Element
\r
24 insertSibling: function(el, where, returnDom){
\r
28 if(Ext.isArray(el)){
\r
29 Ext.each(el, function(e) {
\r
30 rt = me.insertSibling(e, where, returnDom);
\r
35 where = (where || 'before').toLowerCase();
\r
38 if(el.nodeType || el.dom){
\r
39 rt = me.dom.parentNode.insertBefore(GETDOM(el), where == 'before' ? me.dom : me.dom.nextSibling);
\r
44 if (where == 'after' && !me.dom.nextSibling) {
\r
45 rt = DH.append(me.dom.parentNode, el, !returnDom);
\r
47 rt = DH[where == 'after' ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
\r