Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / core / Template-more.js
diff --git a/src/core/Template-more.js b/src/core/Template-more.js
deleted file mode 100644 (file)
index f698eb1..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*!
- * Ext JS Library 3.1.1
- * Copyright(c) 2006-2010 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-/**\r
- * @class Ext.Template\r
- */\r
-Ext.apply(Ext.Template.prototype, {\r
-    /**\r
-     * @cfg {Boolean} disableFormats Specify <tt>true</tt> to disable format\r
-     * functions in the template. If the template does not contain\r
-     * {@link Ext.util.Format format functions}, setting <code>disableFormats</code>\r
-     * to true will reduce <code>{@link #apply}</code> time. Defaults to <tt>false</tt>.\r
-     * <pre><code>\r
-var t = new Ext.Template(\r
-    '&lt;div name="{id}"&gt;',\r
-        '&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',\r
-    '&lt;/div&gt;',\r
-    {\r
-        compiled: true,      // {@link #compile} immediately\r
-        disableFormats: true // reduce <code>{@link #apply}</code> time since no formatting\r
-    }    \r
-);\r
-     * </code></pre>\r
-     * For a list of available format functions, see {@link Ext.util.Format}.\r
-     */\r
-    disableFormats : false,                            \r
-    /**\r
-     * See <code>{@link #disableFormats}</code>.\r
-     * @type Boolean\r
-     * @property disableFormats\r
-     */\r
-\r
-    /**\r
-     * The regular expression used to match template variables\r
-     * @type RegExp\r
-     * @property\r
-     * @hide repeat doc\r
-     */\r
-    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,\r
-\r
-    /**\r
-     * Returns an HTML fragment of this template with the specified values applied.\r
-     * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})\r
-     * @return {String} The HTML fragment\r
-     * @hide repeat doc\r
-     */\r
-    applyTemplate : function(values){\r
-               var me = this,\r
-                       useF = me.disableFormats !== true,\r
-               fm = Ext.util.Format, \r
-               tpl = me;           \r
-           \r
-        if(me.compiled){\r
-            return me.compiled(values);\r
-        }\r
-        function fn(m, name, format, args){\r
-            if (format && useF) {\r
-                if (format.substr(0, 5) == "this.") {\r
-                    return tpl.call(format.substr(5), values[name], values);\r
-                } else {\r
-                    if (args) {\r
-                        // quoted values are required for strings in compiled templates,\r
-                        // but for non compiled we need to strip them\r
-                        // quoted reversed for jsmin\r
-                        var re = /^\s*['"](.*)["']\s*$/;\r
-                        args = args.split(',');\r
-                        for(var i = 0, len = args.length; i < len; i++){\r
-                            args[i] = args[i].replace(re, "$1");\r
-                        }\r
-                        args = [values[name]].concat(args);\r
-                    } else {\r
-                        args = [values[name]];\r
-                    }\r
-                    return fm[format].apply(fm, args);\r
-                }\r
-            } else {\r
-                return values[name] !== undefined ? values[name] : "";\r
-            }\r
-        }\r
-        return me.html.replace(me.re, fn);\r
-    },\r
-               \r
-    /**\r
-     * Compiles the template into an internal function, eliminating the RegEx overhead.\r
-     * @return {Ext.Template} this\r
-     * @hide repeat doc\r
-     */\r
-    compile : function(){\r
-        var me = this,\r
-               fm = Ext.util.Format,\r
-               useF = me.disableFormats !== true,\r
-               sep = Ext.isGecko ? "+" : ",",\r
-               body;\r
-        \r
-        function fn(m, name, format, args){\r
-            if(format && useF){\r
-                args = args ? ',' + args : "";\r
-                if(format.substr(0, 5) != "this."){\r
-                    format = "fm." + format + '(';\r
-                }else{\r
-                    format = 'this.call("'+ format.substr(5) + '", ';\r
-                    args = ", values";\r
-                }\r
-            }else{\r
-                args= ''; format = "(values['" + name + "'] == undefined ? '' : ";\r
-            }\r
-            return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";\r
-        }\r
-        \r
-        // branched to use + in gecko and [].join() in others\r
-        if(Ext.isGecko){\r
-            body = "this.compiled = function(values){ return '" +\r
-                   me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +\r
-                    "';};";\r
-        }else{\r
-            body = ["this.compiled = function(values){ return ['"];\r
-            body.push(me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));\r
-            body.push("'].join('');};");\r
-            body = body.join('');\r
-        }\r
-        eval(body);\r
-        return me;\r
-    },\r
-    \r
-    // private function used to call members\r
-    call : function(fnName, value, allValues){\r
-        return this[fnName](value, allValues);\r
-    }\r
-});\r
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; 
\ No newline at end of file