X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/source/CompositeElementLite.html diff --git a/docs/source/CompositeElementLite.html b/docs/source/CompositeElementLite.html index 16a9832b..ed936613 100644 --- a/docs/source/CompositeElementLite.html +++ b/docs/source/CompositeElementLite.html @@ -1,17 +1,12 @@ - -
-/*! - * Ext JS Library 3.0.3 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license - */ -/** + + + ++ \ No newline at end of fileThe source code + + + + +/** * @class Ext.CompositeElementLite *- +Ext.select = Ext.Element.select;This class encapsulates a collection of DOM elements, providing methods to filter * members, or to perform collective actions upon the whole set.
@@ -63,6 +58,21 @@ Ext.override(Ext.CompositeElementLite, { Ext.CompositeElementLite.prototype = { isComposite: true, + + // private + getElement : function(el){ + // Set the shared flyweight dom property to the current element + var e = this.el; + e.dom = el; + e.id = el.id; + return e; + }, + + // private + transformElement : function(el){ + return Ext.getDom(el); + }, + /** * Returns the number of elements in this Composite. * @return Number @@ -75,27 +85,40 @@ Ext.CompositeElementLite.prototype = { * @param {Mixed} els Either an Array of DOM elements to add, or another Composite object who's elements should be added. * @return {CompositeElement} This Composite object. */ - add : function(els){ - if(els){ - if (Ext.isArray(els)) { - this.elements = this.elements.concat(els); - } else { - var yels = this.elements; - Ext.each(els, function(e) { - yels.push(e); - }); - } + add : function(els, root){ + var me = this, + elements = me.elements; + if(!els){ + return this; } - return this; + if(Ext.isString(els)){ + els = Ext.Element.selectorFunction(els, root); + }else if(els.isComposite){ + els = els.elements; + }else if(!Ext.isIterable(els)){ + els = [els]; + } + + for(var i = 0, len = els.length; i < len; ++i){ + elements.push(me.transformElement(els[i])); + } + return me; }, + invoke : function(fn, args){ - var els = this.elements, - el = this.el; - Ext.each(els, function(e) { - el.dom = e; - Ext.Element.prototype[fn].apply(el, args); - }); - return this; + var me = this, + els = me.elements, + len = els.length, + e, + i; + + for(i = 0; i < len; i++) { + e = els[i]; + if(e){ + Ext.Element.prototype[fn].apply(me.getElement(e), args); + } + } + return me; }, /** * Returns a flyweight Element of the dom element object at the specified index @@ -103,19 +126,28 @@ Ext.CompositeElementLite.prototype = { * @return {Ext.Element} */ item : function(index){ - var me = this; - if(!me.elements[index]){ - return null; + var me = this, + el = me.elements[index], + out = null; + + if(el){ + out = me.getElement(el); } - me.el.dom = me.elements[index]; - return me.el; + return out; }, // fixes scope with flyweight addListener : function(eventName, handler, scope, opt){ - Ext.each(this.elements, function(e) { - Ext.EventManager.on(e, eventName, handler, scope || e, opt); - }); + var els = this.elements, + len = els.length, + i, e; + + for(i = 0; i/** @@ -132,12 +164,19 @@ Ext.CompositeElementLite.prototype = { */ each : function(fn, scope){ var me = this, - el = me.el; - - Ext.each(me.elements, function(e,i) { - el.dom = e; - return fn.call(scope || el, el, me, i); - }); + els = me.elements, + len = els.length, + i, e; + + for(i = 0; i /** @@ -246,13 +288,12 @@ if(Ext.DomQuery){ * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or * {@link Ext.CompositeElementLite CompositeElementLite} object. * @param {String/Array} selector The CSS selector or an array of elements - * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object) Not supported in core * @param {HTMLElement/String} root (optional) The root element of the query or id of the root * @return {CompositeElementLite/CompositeElement} * @member Ext.Element * @method select */ -Ext.Element.select = function(selector, unique, root){ +Ext.Element.select = function(selector, root){ var els; if(typeof selector == "string"){ els = Ext.Element.selectorFunction(selector, root); @@ -268,12 +309,11 @@ Ext.Element.select = function(selector, unique, root){ * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or * {@link Ext.CompositeElementLite CompositeElementLite} object. * @param {String/Array} selector The CSS selector or an array of elements - * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object) * @param {HTMLElement/String} root (optional) The root element of the query or id of the root * @return {CompositeElementLite/CompositeElement} * @member Ext * @method select */ -Ext.select = Ext.Element.select;