X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/docs/source/CompositeElementLite.html diff --git a/docs/source/CompositeElementLite.html b/docs/source/CompositeElementLite.html index 16a9832b..e84961e6 100644 --- a/docs/source/CompositeElementLite.html +++ b/docs/source/CompositeElementLite.html @@ -1,17 +1,12 @@ - - - The source code - - - - -
/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-/**
+
+
+      
+  The source code
+    
+    
+
+
+    
/**
  * @class Ext.CompositeElementLite
  * 

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,39 @@ 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; + + for(i = 0; i/** * Returns a flyweight Element of the dom element object at the specified index @@ -103,19 +125,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 +163,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 +287,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 +308,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;
- +Ext.select = Ext.Element.select;
+ \ No newline at end of file