-<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
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.Template"></div>/**
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.3.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.Template"></div>/**
* @class Ext.Template
* <p>Represents an HTML fragment template. Templates may be {@link #compile precompiled}
* for greater performance.</p>
* <p>For example usage {@link #Template see the constructor}.</p>
- *
+ *
* @constructor
* An instance of this class may be created by passing to the constructor either
* a single argument, or multiple arguments:
{
compiled: true, // {@link #compile} immediately
disableFormats: true // See Notes below.
- }
+ }
);
* </code></pre>
* <p><b>Notes</b>:</p>
*/
Ext.Template = function(html){
var me = this,
- a = arguments,
- buf = [];
+ a = arguments,
+ buf = [],
+ v;
if (Ext.isArray(html)) {
html = html.join("");
} else if (a.length > 1) {
- Ext.each(a, function(v) {
- if (Ext.isObject(v)) {
+ for(var i = 0, len = a.length; i < len; i++){
+ v = a[i];
+ if(typeof v == 'object'){
Ext.apply(me, v);
} else {
buf.push(v);
}
- });
+ };
html = buf.join('');
}
* @return {String} The HTML fragment
*/
applyTemplate : function(values){
- var me = this;
+ var me = this;
return me.compiled ?
- me.compiled(values) :
- me.html.replace(me.re, function(m, name){
- return values[name] !== undefined ? values[name] : "";
- });
- },
+ me.compiled(values) :
+ me.html.replace(me.re, function(m, name){
+ return values[name] !== undefined ? values[name] : "";
+ });
+ },
<div id="method-Ext.Template-set"></div>/**
* Sets the HTML used as the template and optionally compiles it.
* @return {Ext.Template} this
*/
set : function(html, compile){
- var me = this;
+ var me = this;
me.html = html;
me.compiled = null;
return compile ? me.compile() : me;
*/
compile : function(){
var me = this,
- sep = Ext.isGecko ? "+" : ",";
+ sep = Ext.isGecko ? "+" : ",";
- function fn(m, name){
- name = "values['" + name + "']";
- return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
+ function fn(m, name){
+ name = "values['" + name + "']";
+ return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
}
-
+
eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
(Ext.isGecko ? "';};" : "'].join('');};"));
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
-};</pre> \r
-</body>\r
+};
+</pre>
+</body>
</html>
\ No newline at end of file