X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/core/CompositeElement.js diff --git a/src/core/CompositeElement.js b/src/core/CompositeElement.js index be5cc9ba..f366ddb3 100644 --- a/src/core/CompositeElement.js +++ b/src/core/CompositeElement.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -37,7 +37,7 @@ Ext.extend(Ext.CompositeElement, Ext.CompositeElementLite, { }); return this; }, - + /** * Adds elements to this composite. * @param {String/Array} els A string CSS selector, an array of elements or an element @@ -50,13 +50,13 @@ Ext.extend(Ext.CompositeElement, Ext.CompositeElementLite, { if(typeof els == "string"){ els = Ext.Element.selectorFunction(els, root); } - var yels = this.elements; + var yels = this.elements; Ext.each(els, function(e) { yels.push(Ext.get(e)); }); return this; - }, - + }, + /** * Returns the Element object at the specified index * @param {Number} index @@ -70,12 +70,12 @@ Ext.extend(Ext.CompositeElement, Ext.CompositeElementLite, { indexOf : function(el){ return this.elements.indexOf(Ext.get(el)); }, - + filter : function(selector){ var me = this, out = []; - - Ext.each(me.elements, function(el) { + + Ext.each(me.elements, function(el) { if(el.is(selector)){ out.push(Ext.get(el)); } @@ -83,16 +83,31 @@ Ext.extend(Ext.CompositeElement, Ext.CompositeElementLite, { me.elements = out; return me; }, - - /** - * Calls the passed function passing (el, this, index) for each element in this composite. - * @param {Function} fn The function to call - * @param {Object} scope (optional) The this object (defaults to the element) - * @return {CompositeElement} this - */ - each : function(fn, scope){ - Ext.each(this.elements, function(e,i) { - return fn.call(scope || e, e, this, i); + + /** + * Iterates each element in this composite + * calling the supplied function using {@link Ext#each}. + * @param {Function} fn The function to be called with each + * element. If the supplied function returns false, + * iteration stops. This function is called with the following arguments: + *
+ * @param {Object} scope (optional) The scope to call the specified function. + * Defaults to the element at the current index + * within the composite. + * @return {CompositeElement} this + */ + each : function(fn, scope){ + Ext.each(this.elements, function(e, i){ + return fn.call(scope || e, e, this, i); }, this); return this; } @@ -120,7 +135,7 @@ Ext.Element.select = function(selector, unique, root){ } return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els); -}; +}; /** * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods