X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..530ef4b6c5b943cfa68b779d11cf7de29aa878bf:/docs/source/Template-more.html?ds=inline diff --git a/docs/source/Template-more.html b/docs/source/Template-more.html index f6a224f1..b7fc3a0a 100644 --- a/docs/source/Template-more.html +++ b/docs/source/Template-more.html @@ -7,7 +7,7 @@
/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
@@ -29,12 +29,12 @@ var t = new Ext.Template(
{
compiled: true, // {@link #compile} immediately
disableFormats: true // reduce {@link #apply}
time since no formatting
- }
+ }
);
*
* For a list of available format functions, see {@link Ext.util.Format}.
*/
- disableFormats : false,
+ disableFormats : false,
/**
* See {@link #disableFormats}
.
* @type Boolean
@@ -48,6 +48,10 @@ var t = new Ext.Template(
* @hide repeat doc
*/
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
+ argsRe : /^\s*['"](.*)["']\s*$/,
+ compileARe : /\\/g,
+ compileBRe : /(\r\n|\n)/g,
+ compileCRe : /'/g,
/**
* Returns an HTML fragment of this template with the specified values applied.
@@ -56,11 +60,11 @@ var t = new Ext.Template(
* @hide repeat doc
*/
applyTemplate : function(values){
- var me = this,
- useF = me.disableFormats !== true,
- fm = Ext.util.Format,
- tpl = me;
-
+ var me = this,
+ useF = me.disableFormats !== true,
+ fm = Ext.util.Format,
+ tpl = me;
+
if(me.compiled){
return me.compiled(values);
}
@@ -73,7 +77,7 @@ var t = new Ext.Template(
// quoted values are required for strings in compiled templates,
// but for non compiled we need to strip them
// quoted reversed for jsmin
- var re = /^\s*['"](.*)["']\s*$/;
+ var re = me.argsRe;
args = args.split(',');
for(var i = 0, len = args.length; i < len; i++){
args[i] = args[i].replace(re, "$1");
@@ -90,7 +94,7 @@ var t = new Ext.Template(
}
return me.html.replace(me.re, fn);
},
-
+
/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
@@ -98,11 +102,11 @@ var t = new Ext.Template(
*/
compile : function(){
var me = this,
- fm = Ext.util.Format,
- useF = me.disableFormats !== true,
- sep = Ext.isGecko ? "+" : ",",
- body;
-
+ fm = Ext.util.Format,
+ useF = me.disableFormats !== true,
+ sep = Ext.isGecko ? "+" : ",",
+ body;
+
function fn(m, name, format, args){
if(format && useF){
args = args ? ',' + args : "";
@@ -117,27 +121,28 @@ var t = new Ext.Template(
}
return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
}
-
+
// branched to use + in gecko and [].join() in others
if(Ext.isGecko){
body = "this.compiled = function(values){ return '" +
- me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
+ me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn) +
"';};";
}else{
body = ["this.compiled = function(values){ return ['"];
- body.push(me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
+ body.push(me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return me;
},
-
+
// private function used to call members
call : function(fnName, value, allValues){
return this[fnName](value, allValues);
}
});
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
+Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
+