X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..530ef4b6c5b943cfa68b779d11cf7de29aa878bf:/pkgs/ext-foundation-debug.js diff --git a/pkgs/ext-foundation-debug.js b/pkgs/ext-foundation-debug.js index ad181c1c..7a6b21d0 100644 --- a/pkgs/ext-foundation-debug.js +++ b/pkgs/ext-foundation-debug.js @@ -1,5 +1,5 @@ /*! - * 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 @@ -136,6 +136,10 @@ Ext.DomHelper = function(){ var tempTableEl = null, emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i, tableRe = /^table|tbody|tr|td$/i, + confRe = /tag|children|cn|html$/i, + tableElRe = /td|tr|tbody/i, + cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi, + endRe = /end/i, pub, // kill repeat to save bytes afterbegin = 'afterbegin', @@ -164,7 +168,7 @@ Ext.DomHelper = function(){ keyVal, cn; - if(Ext.isString(o)){ + if(typeof o == "string"){ b = o; } else if (Ext.isArray(o)) { for (var i=0; i < o.length; i++) { @@ -174,19 +178,20 @@ Ext.DomHelper = function(){ }; } else { b += '<' + (o.tag = o.tag || 'div'); - Ext.iterate(o, function(attr, val){ - if(!/tag|children|cn|html$/i.test(attr)){ - if (Ext.isObject(val)) { + for (attr in o) { + val = o[attr]; + if(!confRe.test(attr)){ + if (typeof val == "object") { b += ' ' + attr + '="'; - Ext.iterate(val, function(key, keyVal){ - b += key + ':' + keyVal + ';'; - }); + for (key in val) { + b += key + ':' + val[key] + ';'; + }; b += '"'; }else{ b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"'; } } - }); + }; // Now either just close the tag or try to add children and close the tag. if (emptyTags.test(o.tag)) { b += '/>'; @@ -235,7 +240,7 @@ Ext.DomHelper = function(){ tempTableEl = tempTableEl || document.createElement('div'); if(tag == 'td' && (where == afterbegin || where == beforeend) || - !/td|tr|tbody/i.test(tag) && (where == beforebegin || where == afterend)) { + !tableElRe.test(tag) && (where == beforebegin || where == afterend)) { return; } before = where == beforebegin ? el : @@ -268,7 +273,7 @@ Ext.DomHelper = function(){ markup : function(o){ return createHtml(o); }, - + /** * Applies a style specification to an element. * @param {String/HTMLElement} el The element to apply styles to @@ -279,18 +284,18 @@ Ext.DomHelper = function(){ if(styles){ var i = 0, len, - style; + style, + matches; el = Ext.fly(el); - if(Ext.isFunction(styles)){ + if(typeof styles == "function"){ styles = styles.call(); } - if(Ext.isString(styles)){ - styles = styles.trim().split(/\s*(?::|;)\s*/); - for(len = styles.length; i < len;){ - el.setStyle(styles[i++], styles[i++]); + if(typeof styles == "string"){ + while((matches = cssRe.exec(styles))){ + el.setStyle(matches[1], matches[2]); } - }else if (Ext.isObject(styles)){ + }else if (typeof styles == "object"){ el.setStyle(styles); } } @@ -330,7 +335,7 @@ Ext.DomHelper = function(){ } } else { range = el.ownerDocument.createRange(); - setStart = 'setStart' + (/end/i.test(where) ? 'After' : 'Before'); + setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before'); if (hash[where]) { range[setStart](el); frag = range.createContextualFragment(html); @@ -415,27 +420,29 @@ Ext.DomHelper = function(){ createHtml : createHtml }; return pub; -}();/** +}(); +/** * @class Ext.DomHelper */ Ext.apply(Ext.DomHelper, function(){ - var pub, - afterbegin = 'afterbegin', - afterend = 'afterend', - beforebegin = 'beforebegin', - beforeend = 'beforeend'; + var pub, + afterbegin = 'afterbegin', + afterend = 'afterend', + beforebegin = 'beforebegin', + beforeend = 'beforeend', + confRe = /tag|children|cn|html$/i; - // private + // private function doInsert(el, o, returnElement, pos, sibling, append){ el = Ext.getDom(el); var newNode; if (pub.useDom) { newNode = createDom(o, null); if (append) { - el.appendChild(newNode); + el.appendChild(newNode); } else { - (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el); + (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el); } } else { newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o)); @@ -443,39 +450,40 @@ function(){ return returnElement ? Ext.get(newNode, true) : newNode; } - // build as dom + // build as dom /** @ignore */ function createDom(o, parentNode){ var el, - doc = document, - useSet, - attr, - val, - cn; + doc = document, + useSet, + attr, + val, + cn; if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted el = doc.createDocumentFragment(); // in one shot using a DocumentFragment - Ext.each(o, function(v) { - createDom(v, el); - }); - } else if (Ext.isString(o)) { // Allow a string as a child spec. + for (var i = 0, l = o.length; i < l; i++) { + createDom(o[i], el); + } + } else if (typeof o == 'string') { // Allow a string as a child spec. el = doc.createTextNode(o); } else { el = doc.createElement( o.tag || 'div' ); useSet = !!el.setAttribute; // In IE some elements don't have setAttribute - Ext.iterate(o, function(attr, val){ - if(!/tag|children|cn|html|style/.test(attr)){ - if(attr == 'cls'){ - el.className = val; - }else{ + for (var attr in o) { + if(!confRe.test(attr)){ + val = o[attr]; + if(attr == 'cls'){ + el.className = val; + }else{ if(useSet){ el.setAttribute(attr, val); }else{ el[attr] = val; } - } + } } - }); + } Ext.DomHelper.applyStyles(el, o.style); if ((cn = o.children || o.cn)) { @@ -490,82 +498,83 @@ function(){ return el; } - pub = { - /** - * Creates a new Ext.Template from the DOM object spec. - * @param {Object} o The DOM object spec (and children) - * @return {Ext.Template} The new template - */ - createTemplate : function(o){ - var html = Ext.DomHelper.createHtml(o); - return new Ext.Template(html); - }, + pub = { + /** + * Creates a new Ext.Template from the DOM object spec. + * @param {Object} o The DOM object spec (and children) + * @return {Ext.Template} The new template + */ + createTemplate : function(o){ + var html = Ext.DomHelper.createHtml(o); + return new Ext.Template(html); + }, - /** True to force the use of DOM instead of html fragments @type Boolean */ - useDom : false, + /** True to force the use of DOM instead of html fragments @type Boolean */ + useDom : false, - /** - * Creates new DOM element(s) and inserts them before el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node + /** + * Creates new DOM element(s) and inserts them before el. + * @param {Mixed} el The context element + * @param {Object/String} o The DOM object spec (and children) or raw HTML blob + * @param {Boolean} returnElement (optional) true to return a Ext.Element + * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) - */ - insertBefore : function(el, o, returnElement){ - return doInsert(el, o, returnElement, beforebegin); - }, + */ + insertBefore : function(el, o, returnElement){ + return doInsert(el, o, returnElement, beforebegin); + }, - /** - * Creates new DOM element(s) and inserts them after el. - * @param {Mixed} el The context element - * @param {Object} o The DOM object spec (and children) - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node + /** + * Creates new DOM element(s) and inserts them after el. + * @param {Mixed} el The context element + * @param {Object} o The DOM object spec (and children) + * @param {Boolean} returnElement (optional) true to return a Ext.Element + * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) - */ - insertAfter : function(el, o, returnElement){ - return doInsert(el, o, returnElement, afterend, 'nextSibling'); - }, + */ + insertAfter : function(el, o, returnElement){ + return doInsert(el, o, returnElement, afterend, 'nextSibling'); + }, - /** - * Creates new DOM element(s) and inserts them as the first child of el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node + /** + * Creates new DOM element(s) and inserts them as the first child of el. + * @param {Mixed} el The context element + * @param {Object/String} o The DOM object spec (and children) or raw HTML blob + * @param {Boolean} returnElement (optional) true to return a Ext.Element + * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) - */ - insertFirst : function(el, o, returnElement){ - return doInsert(el, o, returnElement, afterbegin, 'firstChild'); - }, + */ + insertFirst : function(el, o, returnElement){ + return doInsert(el, o, returnElement, afterbegin, 'firstChild'); + }, - /** - * Creates new DOM element(s) and appends them to el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node + /** + * Creates new DOM element(s) and appends them to el. + * @param {Mixed} el The context element + * @param {Object/String} o The DOM object spec (and children) or raw HTML blob + * @param {Boolean} returnElement (optional) true to return a Ext.Element + * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) - */ - append: function(el, o, returnElement){ + */ + append: function(el, o, returnElement){ return doInsert(el, o, returnElement, beforeend, '', true); }, - /** - * Creates new DOM element(s) without inserting them to the document. - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @return {HTMLElement} The new uninserted node - */ + /** + * Creates new DOM element(s) without inserting them to the document. + * @param {Object/String} o The DOM object spec (and children) or raw HTML blob + * @return {HTMLElement} The new uninserted node + */ createDom: createDom - }; - return pub; -}());/** + }; + return pub; +}()); +/** * @class Ext.Template *
Represents an HTML fragment template. Templates may be {@link #compile precompiled} * for greater performance.
*For example usage {@link #Template see the constructor}.
- * + * * @constructor * An instance of this class may be created by passing to the constructor either * a single argument, or multiple arguments: @@ -601,7 +610,7 @@ var t = new Ext.Template( { compiled: true, // {@link #compile} immediately disableFormats: true // See Notes below. - } + } ); * *Notes:
@@ -617,19 +626,21 @@ var t = new Ext.Template( */ 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(''); } @@ -667,14 +678,14 @@ Ext.Template.prototype = { * @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] : ""; + }); + }, /** * Sets the HTML used as the template and optionally compiles it. @@ -683,7 +694,7 @@ Ext.Template.prototype = { * @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; @@ -695,13 +706,13 @@ Ext.Template.prototype = { */ 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('');};")); @@ -797,7 +808,8 @@ Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; Ext.Template.from = function(el, config){ el = Ext.getDom(el); return new Ext.Template(el.value || el.innerHTML, config || ''); -};/** +}; +/** * @class Ext.Template */ Ext.apply(Ext.Template.prototype, { @@ -814,12 +826,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
@@ -833,6 +845,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.
@@ -841,11 +857,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);
}
@@ -858,7 +874,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");
@@ -875,7 +891,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
@@ -883,11 +899,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 : "";
@@ -902,28 +918,29 @@ 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;
+/*
* This is code is also distributed under MIT license for use
* with jQuery and prototype JavaScript libraries.
*/
@@ -1909,9 +1926,7 @@ Ext.util.DelayedTask = function(fn, scope, args){
};(function(){
var EXTUTIL = Ext.util,
- TOARRAY = Ext.toArray,
EACH = Ext.each,
- ISOBJECT = Ext.isObject,
TRUE = true,
FALSE = false;
/**
@@ -2031,11 +2046,12 @@ EXTUTIL.Observable.prototype = {
* @return {Boolean} returns false if any of the handlers return false otherwise it returns true.
*/
fireEvent : function(){
- var a = TOARRAY(arguments),
+ var a = Array.prototype.slice.call(arguments, 0),
ename = a[0].toLowerCase(),
me = this,
ret = TRUE,
ce = me.events[ename],
+ cc,
q,
c;
if (me.eventsSuspended === TRUE) {
@@ -2043,20 +2059,21 @@ EXTUTIL.Observable.prototype = {
q.push(a);
}
}
- else if(ISOBJECT(ce) && ce.bubble){
- if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
- return FALSE;
- }
- c = me.getBubbleTarget && me.getBubbleTarget();
- if(c && c.enableBubble) {
- if(!c.events[ename] || !Ext.isObject(c.events[ename]) || !c.events[ename].bubble) {
- c.enableBubble(ename);
+ else if(typeof ce == 'object') {
+ if (ce.bubble){
+ if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
+ return FALSE;
+ }
+ c = me.getBubbleTarget && me.getBubbleTarget();
+ if(c && c.enableBubble) {
+ cc = c.events[ename];
+ if(!cc || typeof cc != 'object' || !cc.bubble) {
+ c.enableBubble(ename);
+ }
+ return c.fireEvent.apply(c, a);
}
- return c.fireEvent.apply(c, a);
}
- }
- else {
- if (ISOBJECT(ce)) {
+ else {
a.shift();
ret = ce.fire.apply(ce, a);
}
@@ -2129,7 +2146,7 @@ myGridPanel.on({
oe,
isF,
ce;
- if (ISOBJECT(eventName)) {
+ if (typeof eventName == 'object') {
o = eventName;
for (e in o){
oe = o[e];
@@ -2140,10 +2157,10 @@ myGridPanel.on({
} else {
eventName = eventName.toLowerCase();
ce = me.events[eventName] || TRUE;
- if (Ext.isBoolean(ce)) {
+ if (typeof ce == 'boolean') {
me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
}
- ce.addListener(fn, scope, ISOBJECT(o) ? o : {});
+ ce.addListener(fn, scope, typeof o == 'object' ? o : {});
}
},
@@ -2155,7 +2172,7 @@ myGridPanel.on({
*/
removeListener : function(eventName, fn, scope){
var ce = this.events[eventName.toLowerCase()];
- if (ISOBJECT(ce)) {
+ if (typeof ce == 'object') {
ce.removeListener(fn, scope);
}
},
@@ -2169,7 +2186,7 @@ myGridPanel.on({
key;
for(key in events){
evt = events[key];
- if(ISOBJECT(evt)){
+ if(typeof evt == 'object'){
evt.clearListeners();
}
}
@@ -2187,7 +2204,7 @@ this.addEvents('storeloaded', 'storecleared');
addEvents : function(o){
var me = this;
me.events = me.events || {};
- if (Ext.isString(o)) {
+ if (typeof o == 'string') {
var a = arguments,
i = a.length;
while(i--) {
@@ -2205,7 +2222,7 @@ this.addEvents('storeloaded', 'storecleared');
*/
hasListener : function(eventName){
var e = this.events[eventName.toLowerCase()];
- return ISOBJECT(e) && e.listeners.length > 0;
+ return typeof e == 'object' && e.listeners.length > 0;
},
/**
@@ -2268,7 +2285,7 @@ EXTUTIL.Observable.releaseCapture = function(o){
function createTargeted(h, o, scope){
return function(){
if(o.target == arguments[0]){
- h.apply(scope, TOARRAY(arguments));
+ h.apply(scope, Array.prototype.slice.call(arguments, 0));
}
};
};
@@ -2276,7 +2293,7 @@ function createTargeted(h, o, scope){
function createBuffered(h, o, l, scope){
l.task = new EXTUTIL.DelayedTask();
return function(){
- l.task.delay(o.buffer, h, scope, TOARRAY(arguments));
+ l.task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
@@ -2294,7 +2311,7 @@ function createDelayed(h, o, l, scope){
l.tasks = [];
}
l.tasks.push(task);
- task.delay(o.delay || 10, h, scope, TOARRAY(arguments));
+ task.delay(o.delay || 10, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
@@ -2345,7 +2362,7 @@ EXTUTIL.Event.prototype = {
var list = this.listeners,
i = list.length,
l;
-
+
scope = scope || this.obj;
while(i--){
l = list[i];
@@ -2402,7 +2419,6 @@ EXTUTIL.Event.prototype = {
fire : function(){
var me = this,
- args = TOARRAY(arguments),
listeners = me.listeners,
len = listeners.length,
i = 0,
@@ -2410,6 +2426,7 @@ EXTUTIL.Event.prototype = {
if(len > 0){
me.firing = TRUE;
+ var args = Array.prototype.slice.call(arguments, 0);
for (; i < len; i++) {
l = listeners[i];
if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
@@ -2420,8 +2437,10 @@ EXTUTIL.Event.prototype = {
me.firing = FALSE;
return TRUE;
}
+
};
-})();/**
+})();
+/**
* @class Ext.util.Observable
*/
Ext.apply(Ext.util.Observable.prototype, function(){
@@ -2440,9 +2459,13 @@ Ext.apply(Ext.util.Observable.prototype, function(){
e.after = [];
var makeCall = function(fn, scope, args){
- if (!Ext.isEmpty(v = fn.apply(scope || obj, args))) {
- if (Ext.isObject(v)) {
- returnValue = !Ext.isEmpty(v.returnValue) ? v.returnValue : v;
+ if((v = fn.apply(scope || obj, args)) !== undefined){
+ if (typeof v == 'object') {
+ if(v.returnValue !== undefined){
+ returnValue = v.returnValue;
+ }else{
+ returnValue = v;
+ }
cancel = !!v.cancel;
}
else
@@ -2456,26 +2479,30 @@ Ext.apply(Ext.util.Observable.prototype, function(){
};
this[method] = function(){
- var args = Ext.toArray(arguments);
+ var args = Array.prototype.slice.call(arguments, 0),
+ b;
returnValue = v = undefined;
cancel = false;
- Ext.each(e.before, function(b){
+ for(var i = 0, len = e.before.length; i < len; i++){
+ b = e.before[i];
makeCall(b.fn, b.scope, args);
if (cancel) {
return returnValue;
}
- });
+ }
- if (!Ext.isEmpty(v = e.originalFn.apply(obj, args))) {
+ if((v = e.originalFn.apply(obj, args)) !== undefined){
returnValue = v;
}
- Ext.each(e.after, function(a){
- makeCall(a.fn, a.scope, args);
+
+ for(var i = 0, len = e.after.length; i < len; i++){
+ b = e.after[i];
+ makeCall(b.fn, b.scope, args);
if (cancel) {
return returnValue;
}
- });
+ }
return returnValue;
};
}
@@ -2502,21 +2529,18 @@ Ext.apply(Ext.util.Observable.prototype, function(){
},
removeMethodListener: function(method, fn, scope){
- var e = getMethodEvent.call(this, method), found = false;
- Ext.each(e.before, function(b, i, arr){
- if (b.fn == fn && b.scope == scope) {
- arr.splice(i, 1);
- found = true;
- return false;
+ var e = this.getMethodEvent(method);
+ for(var i = 0, len = e.before.length; i < len; i++){
+ if(e.before[i].fn == fn && e.before[i].scope == scope){
+ e.before.splice(i, 1);
+ return;
+ }
+ }
+ for(var i = 0, len = e.after.length; i < len; i++){
+ if(e.after[i].fn == fn && e.after[i].scope == scope){
+ e.after.splice(i, 1);
+ return;
}
- });
- if (!found) {
- Ext.each(e.after, function(a, i, arr){
- if (a.fn == fn && a.scope == scope) {
- arr.splice(i, 1);
- return false;
- }
- });
}
},
@@ -2529,13 +2553,14 @@ Ext.apply(Ext.util.Observable.prototype, function(){
var me = this;
function createHandler(ename){
return function(){
- return me.fireEvent.apply(me, [ename].concat(Ext.toArray(arguments)));
+ return me.fireEvent.apply(me, [ename].concat(Array.prototype.slice.call(arguments, 0)));
};
}
- Ext.each(events, function(ename){
+ for(var i = 0, len = events.length; i < len; i++){
+ var ename = events[i];
me.events[ename] = me.events[ename] || true;
o.on(ename, createHandler(ename), me);
- });
+ }
},
/**
@@ -2578,16 +2603,17 @@ var myForm = new Ext.formPanel({
enableBubble : function(events){
var me = this;
if(!Ext.isEmpty(events)){
- events = Ext.isArray(events) ? events : Ext.toArray(arguments);
- Ext.each(events, function(ename){
+ events = Ext.isArray(events) ? events : Array.prototype.slice.call(arguments, 0);
+ for(var i = 0, len = events.length; i < len; i++){
+ var ename = events[i];
ename = ename.toLowerCase();
var ce = me.events[ename] || true;
- if (Ext.isBoolean(ce)) {
+ if (typeof ce == 'boolean') {
ce = new Ext.util.Event(me, ename);
me.events[ename] = ce;
}
ce.bubble = true;
- });
+ }
}
}
};
@@ -2619,7 +2645,7 @@ Ext.data.Connection.on('beforerequest', function(con, options) {
console.log('Ajax request made to ' + options.url);
});
* @param {Function} c The class constructor to make observable.
- * @param {Object} listeners An object containing a series of listeners to add. See {@link #addListener}.
+ * @param {Object} listeners An object containing a series of listeners to add. See {@link #addListener}.
* @static
*/
Ext.util.Observable.observeClass = function(c, listeners){
@@ -2628,12 +2654,13 @@ Ext.util.Observable.observeClass = function(c, listeners){
Ext.apply(c, new Ext.util.Observable());
Ext.util.Observable.capture(c.prototype, c.fireEvent, c);
}
- if(Ext.isObject(listeners)){
+ if(typeof listeners == 'object'){
c.on(listeners);
}
return c;
}
-};/**
+};
+/**
* @class Ext.EventManager
* Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
* several useful events directly.
@@ -2877,7 +2904,7 @@ Ext.EventManager = function(){
};
function listen(element, ename, opt, fn, scope){
- var o = !Ext.isObject(opt) ? {} : opt,
+ var o = (!opt || typeof opt == "boolean") ? {} : opt,
el = Ext.getDom(element), task;
fn = fn || o.fn;
@@ -2965,7 +2992,7 @@ Ext.EventManager = function(){
* See {@link Ext.Element#addListener} for examples of how to use these options.
*/ addListener : function(element, eventName, fn, scope, options){ - if(Ext.isObject(eventName)){ + if(typeof eventName == 'object'){ var o = eventName, e, val; for(e in o){ val = o[e]; @@ -3145,7 +3172,7 @@ Ext.EventManager = function(){ conn, tid, ajax = Ext.lib.Ajax; - (Ext.isObject(ajax.conn)) ? conn = ajax.conn : conn = {}; + (typeof ajax.conn == 'object') ? conn = ajax.conn : conn = {}; for (tid in conn) { c = conn[tid]; if (c) { @@ -4910,7 +4937,7 @@ Ext.Element.addMethods({ if(loadScripts !== true){ this.dom.innerHTML = html; - if(Ext.isFunction(callback)){ + if(typeof callback == 'function'){ callback(); } return this; @@ -4955,7 +4982,7 @@ Ext.Element.addMethods({ } el = DOC.getElementById(id); if(el){Ext.removeNode(el);} - if(Ext.isFunction(callback)){ + if(typeof callback == 'function'){ callback(); } }); @@ -4978,7 +5005,7 @@ Ext.Element.addMethods({ * @return {Ext.Element} The new proxy element */ createProxy : function(config, renderTo, matchBox){ - config = Ext.isObject(config) ? config : {tag : "div", cls: config}; + config = (typeof config == 'object') ? config : {tag : "div", cls: config}; var me = this, proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) : @@ -5778,6 +5805,8 @@ Ext.Element.addMethods(function(){ propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat', opacityRe = /alpha\(opacity=(.*)\)/i, trimRe = /^\s+|\s+$/g, + spacesRe = /\s+/, + wordsRe = /\w/g, EL = Ext.Element, PADDING = "padding", MARGIN = "margin", @@ -5814,7 +5843,7 @@ Ext.Element.addMethods(function(){ // private ==> used by Fx adjustWidth : function(width) { var me = this; - var isNum = Ext.isNumber(width); + var isNum = (typeof width == "number"); if(isNum && me.autoBoxAdjust && !me.isBorderBox()){ width -= (me.getBorderWidth("lr") + me.getPadding("lr")); } @@ -5824,7 +5853,7 @@ Ext.Element.addMethods(function(){ // private ==> used by Fx adjustHeight : function(height) { var me = this; - var isNum = Ext.isNumber(height); + var isNum = (typeof height == "number"); if(isNum && me.autoBoxAdjust && !me.isBorderBox()){ height -= (me.getBorderWidth("tb") + me.getPadding("tb")); } @@ -5838,14 +5867,60 @@ Ext.Element.addMethods(function(){ * @return {Ext.Element} this */ addClass : function(className){ - var me = this, i, len, v; - className = Ext.isArray(className) ? className : [className]; - for (i=0, len = className.length; i < len; i++) { - v = className[i]; - if (v) { - me.dom.className += (!me.hasClass(v) && v ? " " + v : ""); - }; - }; + var me = this, + i, + len, + v, + cls = []; + // Separate case is for speed + if (!Ext.isArray(className)) { + if (typeof className == 'string' && !this.hasClass(className)) { + me.dom.className += " " + className; + } + } + else { + for (i = 0, len = className.length; i < len; i++) { + v = className[i]; + if (typeof v == 'string' && (' ' + me.dom.className + ' ').indexOf(' ' + v + ' ') == -1) { + cls.push(v); + } + } + if (cls.length) { + me.dom.className += " " + cls.join(" "); + } + } + return me; + }, + + /** + * Removes one or more CSS classes from the element. + * @param {String/Array} className The CSS class to remove, or an array of classes + * @return {Ext.Element} this + */ + removeClass : function(className){ + var me = this, + i, + idx, + len, + cls, + elClasses; + if (!Ext.isArray(className)){ + className = [className]; + } + if (me.dom && me.dom.className) { + elClasses = me.dom.className.replace(trimRe, '').split(spacesRe); + for (i = 0, len = className.length; i < len; i++) { + cls = className[i]; + if (typeof cls == 'string') { + cls = cls.replace(trimRe, ''); + idx = elClasses.indexOf(cls); + if (idx != -1) { + elClasses.splice(idx, 1); + } + } + } + me.dom.className = elClasses.join(" "); + } return me; }, @@ -5855,38 +5930,20 @@ Ext.Element.addMethods(function(){ * @return {Ext.Element} this */ radioClass : function(className){ - var cn = this.dom.parentNode.childNodes, v; + var cn = this.dom.parentNode.childNodes, + v, + i, + len; className = Ext.isArray(className) ? className : [className]; - for (var i=0, len = cn.length; i < len; i++) { + for (i = 0, len = cn.length; i < len; i++) { v = cn[i]; - if(v && v.nodeType == 1) { + if (v && v.nodeType == 1) { Ext.fly(v, '_internal').removeClass(className); } }; return this.addClass(className); }, - /** - * Removes one or more CSS classes from the element. - * @param {String/Array} className The CSS class to remove, or an array of classes - * @return {Ext.Element} this - */ - removeClass : function(className){ - var me = this, v; - className = Ext.isArray(className) ? className : [className]; - if (me.dom && me.dom.className) { - for (var i=0, len=className.length; i < len; i++) { - v = className[i]; - if(v) { - me.dom.className = me.dom.className.replace( - classReCache[v] = classReCache[v] || new RegExp('(?:^|\\s+)' + v + '(?:\\s+|$)', "g"), " " - ); - } - }; - } - return me; - }, - /** * Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it). * @param {String} className The CSS class to toggle @@ -5934,7 +5991,7 @@ Ext.Element.addMethods(function(){ display, wk = Ext.isWebKit, display; - + if(el == document){ return null; } @@ -5989,7 +6046,7 @@ Ext.Element.addMethods(function(){ */ getColor : function(attr, defaultValue, prefix){ var v = this.getStyle(attr), - color = Ext.isDefined(prefix) ? prefix : '#', + color = (typeof prefix != 'undefined') ? prefix : '#', h; if(!v || /transparent|inherit/.test(v)){ @@ -6017,7 +6074,7 @@ Ext.Element.addMethods(function(){ var tmp, style, camel; - if (!Ext.isObject(prop)) { + if (typeof prop != 'object') { tmp = {}; tmp[prop] = value; prop = tmp; @@ -6218,16 +6275,20 @@ Ext.fly('elId').setHeight(150, { // private addStyles : function(sides, styles){ - var val = 0, - m = sides.match(/\w/g), - s; - for (var i=0, len=m.length; iFor example usage {@link #XTemplate see the constructor}.
- * + * + *For example usage {@link #XTemplate see the constructor}.
+ * * @constructor * The {@link Ext.Template#Template Ext.Template constructor} describes * the acceptable parameters to pass to the constructor. The following * examples demonstrate all of the supported features. - * + * *This is the data object used for reference in each code example:
*
@@ -13005,9 +13070,9 @@ var data = {
*
* The tpl tag and the for operator are used * to process the provided data object: @@ -13078,9 +13143,9 @@ tpl.overwrite(panel.body, data); * *
The tpl tag and the if operator are used * to provide conditional checks for deciding whether or not to render specific @@ -13115,9 +13180,9 @@ tpl.overwrite(panel.body, data); * *
The following basic math operators may be applied directly on numeric * data values:
@@ -13141,8 +13206,8 @@ tpl.overwrite(panel.body, data); *
Anything between {[ ... ]}
is considered code to be executed
* in the scope of the template. There are some special variables available in that code:
@@ -13173,8 +13238,8 @@ tpl.overwrite(panel.body, data);
*
*
One or more member functions can be specified in a configuration * object passed into the XTemplate constructor for more complex processing:
@@ -13211,40 +13276,40 @@ tpl.overwrite(panel.body, data); * *