Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / src / core / core / Element.insertion.js
index 07757d8..d4cf2f5 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.1.0
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -11,10 +11,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
            /**\r
@@ -63,14 +60,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
            /**\r
             * Replaces the passed element with this element\r
@@ -90,19 +87,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
                /**\r