</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.0
- * Copyright(c) 2006-2010 Ext JS, Inc.
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
/**
* @class Ext.Template
{
compiled: true, // {@link #compile} immediately
disableFormats: true // reduce <code>{@link #apply}</code> time since no formatting
- }
+ }
);
* </code></pre>
* For a list of available format functions, see {@link Ext.util.Format}.
*/
- disableFormats : false,
+ disableFormats : false,
<div id="prop-Ext.Template-disableFormats"></div>/**
* See <code>{@link #disableFormats}</code>.
* @type Boolean
* @hide repeat doc
*/
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
+ argsRe : /^\s*['"](.*)["']\s*$/,
+ compileARe : /\\/g,
+ compileBRe : /(\r\n|\n)/g,
+ compileCRe : /'/g,
<div id="method-Ext.Template-applyTemplate"></div>/**
* Returns an HTML fragment of this template with the specified values applied.
* @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);
}
// 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");
}
return me.html.replace(me.re, fn);
},
-
+
<div id="method-Ext.Template-compile"></div>/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
*/
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 : "";
}
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; </pre>
+Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
+</pre>
</body>
</html>
\ No newline at end of file