Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / Element.insertion.html
index a5744f3..eac4a9e 100644 (file)
@@ -1,5 +1,6 @@
 <html>\r
 <head>\r
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \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
@@ -12,10 +13,7 @@ Ext.Element.addMethods(
 function() {\r
        var GETDOM = Ext.getDom,\r
                GET = Ext.get,\r
-               DH = Ext.DomHelper,\r
-        isEl = function(el){\r
-            return  (el.nodeType || el.dom || typeof el == 'string');  \r
-        };\r
+               DH = Ext.DomHelper;\r
        \r
        return {\r
            <div id="method-Ext.Element-appendChild"></div>/**\r
@@ -64,14 +62,14 @@ function() {
             */\r
            insertFirst: function(el, returnDom){\r
             el = el || {};\r
-            if(isEl(el)){ // element\r
+            if(el.nodeType || el.dom || typeof el == 'string'){ // element\r
                 el = GETDOM(el);\r
                 this.dom.insertBefore(el, this.dom.firstChild);\r
                 return !returnDom ? GET(el) : el;\r
             }else{ // dh config\r
                 return this.createChild(el, this.dom.firstChild, returnDom);\r
             }\r
-    },\r
+        },\r
        \r
            <div id="method-Ext.Element-replace"></div>/**\r
             * Replaces the passed element with this element\r
@@ -91,19 +89,20 @@ function() {
             * @return {Ext.Element} this\r
             */\r
            replaceWith: function(el){\r
-                   var me = this,\r
-                       Element = Ext.Element;\r
-            if(isEl(el)){\r
+                   var me = this;\r
+                \r
+            if(el.nodeType || el.dom || typeof el == 'string'){\r
                 el = GETDOM(el);\r
                 me.dom.parentNode.insertBefore(el, me.dom);\r
             }else{\r
                 el = DH.insertBefore(me.dom, el);\r
             }\r
                \r
-               delete Element.cache[me.id];\r
+               delete Ext.elCache[me.id];\r
                Ext.removeNode(me.dom);      \r
                me.id = Ext.id(me.dom = el);\r
-               return Element.cache[me.id] = me;        \r
+               Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);     \r
+            return me;\r
            },\r
            \r
                <div id="method-Ext.Element-createChild"></div>/**\r