Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / Element.insertion-more.html
diff --git a/docs/source/Element.insertion-more.html b/docs/source/Element.insertion-more.html
new file mode 100644 (file)
index 0000000..7886cf9
--- /dev/null
@@ -0,0 +1,55 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.apply(Ext.Element.prototype, function() {\r
+       var GETDOM = Ext.getDom,\r
+               GET = Ext.get,\r
+               DH = Ext.DomHelper;\r
+       \r
+       return {        \r
+               <div id="method-Ext.Element-insertSibling"></div>/**\r
+            * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element\r
+            * @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
+            * @param {String} where (optional) 'before' or 'after' defaults to before\r
+            * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element\r
+            * @return {Ext.Element} the inserted Element\r
+            */\r
+           insertSibling: function(el, where, returnDom){\r
+               var me = this,\r
+                       rt;\r
+                       \r
+               if(Ext.isArray(el)){            \r
+                   Ext.each(el, function(e) {\r
+                           rt = me.insertSibling(e, where, returnDom);\r
+                   });\r
+                   return rt;\r
+               }\r
+                       \r
+               where = (where || 'before').toLowerCase();\r
+               el = el || {};\r
+               \r
+            if(el.nodeType || el.dom){\r
+                rt = me.dom.parentNode.insertBefore(GETDOM(el), where == 'before' ? me.dom : me.dom.nextSibling);\r
+                if (!returnDom) {\r
+                    rt = GET(rt);\r
+                }\r
+            }else{\r
+                if (where == 'after' && !me.dom.nextSibling) {\r
+                    rt = DH.append(me.dom.parentNode, el, !returnDom);\r
+                } else {                    \r
+                    rt = DH[where == 'after' ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);\r
+                }\r
+            }\r
+               return rt;\r
+           }\r
+    };\r
+}());</pre>    \r
+</body>\r
+</html>
\ No newline at end of file