--- /dev/null
+<html>\r
+<head>\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.CompositeElementLite"></div>/**\r
+ * @class Ext.CompositeElementLite\r
+ * Flyweight composite class. Reuses the same Ext.Element for element operations.\r
+ <pre><code>\r
+ var els = Ext.select("#some-el div.some-class");\r
+ // or select directly from an existing element\r
+ var el = Ext.get('some-el');\r
+ el.select('div.some-class');\r
+\r
+ els.setWidth(100); // all elements become 100 width\r
+ els.hide(true); // all elements fade out and hide\r
+ // or\r
+ els.setWidth(100).hide(true);\r
+ </code></pre><br><br>\r
+ * <b>NOTE: Although they are not listed, this class supports all of the set/update methods of Ext.Element. All Ext.Element\r
+ * actions will be performed on all the elements in this collection.</b>\r
+ */\r
+Ext.CompositeElementLite = function(els, root){\r
+ this.elements = [];\r
+ this.add(els, root);\r
+ this.el = new Ext.Element.Flyweight();\r
+};\r
+\r
+Ext.CompositeElementLite.prototype = {\r
+ isComposite: true, \r
+ <div id="method-Ext.CompositeElementLite-getCount"></div>/**\r
+ * Returns the number of elements in this composite\r
+ * @return Number\r
+ */\r
+ getCount : function(){\r
+ return this.elements.length;\r
+ }, \r
+ add : function(els){\r
+ if(els){\r
+ if (Ext.isArray(els)) {\r
+ this.elements = this.elements.concat(els);\r
+ } else {\r
+ var yels = this.elements; \r
+ Ext.each(els, function(e) {\r
+ yels.push(e);\r
+ });\r
+ }\r
+ }\r
+ return this;\r
+ },\r
+ invoke : function(fn, args){\r
+ var els = this.elements,\r
+ el = this.el; \r
+ Ext.each(els, function(e) { \r
+ el.dom = e;\r
+ Ext.Element.prototype[fn].apply(el, args);\r
+ });\r
+ return this;\r
+ },\r
+ <div id="method-Ext.CompositeElementLite-item"></div>/**\r
+ * Returns a flyweight Element of the dom element object at the specified index\r
+ * @param {Number} index\r
+ * @return {Ext.Element}\r
+ */\r
+ item : function(index){\r
+ var me = this;\r
+ if(!me.elements[index]){\r
+ return null;\r
+ }\r
+ me.el.dom = me.elements[index];\r
+ return me.el;\r
+ },\r
+\r
+ // fixes scope with flyweight\r
+ addListener : function(eventName, handler, scope, opt){\r
+ Ext.each(this.elements, function(e) {\r
+ Ext.EventManager.on(e, eventName, handler, scope || e, opt);\r
+ });\r
+ return this;\r
+ },\r
+ <div id="method-Ext.CompositeElementLite-each"></div>/**\r
+ * Calls the passed function passing (el, this, index) for each element in this composite. <b>The element\r
+ * passed is the flyweight (shared) Ext.Element instance, so if you require a\r
+ * a reference to the dom node, use el.dom.</b>\r
+ * @param {Function} fn The function to call\r
+ * @param {Object} scope (optional) The <i>this</i> object (defaults to the element)\r
+ * @return {CompositeElement} this\r
+ */\r
+ each : function(fn, scope){ \r
+ var me = this,\r
+ el = me.el;\r
+ \r
+ Ext.each(me.elements, function(e,i) { \r
+ el.dom = e;\r
+ return fn.call(scope || el, el, me, i);\r
+ });\r
+ return me;\r
+ },\r
+ \r
+ <div id="method-Ext.CompositeElementLite-indexOf"></div>/**\r
+ * Find the index of the passed element within the composite collection.\r
+ * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.\r
+ * @return Number The index of the passed Ext.Element in the composite collection, or -1 if not found.\r
+ */\r
+ indexOf : function(el){\r
+ return this.elements.indexOf(Ext.getDom(el));\r
+ },\r
+ \r
+ <div id="method-Ext.CompositeElementLite-replaceElement"></div>/**\r
+ * Replaces the specified element with the passed element.\r
+ * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite\r
+ * to replace.\r
+ * @param {Mixed} replacement The id of an element or the Element itself.\r
+ * @param {Boolean} domReplace (Optional) True to remove and replace the element in the document too.\r
+ * @return {CompositeElement} this\r
+ */ \r
+ replaceElement : function(el, replacement, domReplace){\r
+ var index = !isNaN(el) ? el : this.indexOf(el),\r
+ d;\r
+ if(index > -1){\r
+ replacement = Ext.getDom(replacement);\r
+ if(domReplace){\r
+ d = this.elements[index];\r
+ d.parentNode.insertBefore(replacement, d);\r
+ Ext.removeNode(d);\r
+ }\r
+ this.elements.splice(index, 1, replacement);\r
+ }\r
+ return this;\r
+ },\r
+ \r
+ <div id="method-Ext.CompositeElementLite-clear"></div>/**\r
+ * Removes all elements.\r
+ */\r
+ clear : function(){\r
+ this.elements = [];\r
+ }\r
+};\r
+\r
+Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;\r
+\r
+(function(){\r
+var fnName,\r
+ ElProto = Ext.Element.prototype,\r
+ CelProto = Ext.CompositeElementLite.prototype;\r
+ \r
+for(fnName in ElProto){\r
+ if(Ext.isFunction(ElProto[fnName])){\r
+ (function(fnName){ \r
+ CelProto[fnName] = CelProto[fnName] || function(){\r
+ return this.invoke(fnName, arguments);\r
+ };\r
+ }).call(CelProto, fnName);\r
+ \r
+ }\r
+}\r
+})();\r
+\r
+if(Ext.DomQuery){\r
+ Ext.Element.selectorFunction = Ext.DomQuery.select;\r
+} \r
+\r
+<div id="method-Ext.Element-select"></div>/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or\r
+ * {@link Ext.CompositeElementLite CompositeElementLite} object.\r
+ * @param {String/Array} selector The CSS selector or an array of elements\r
+ * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object) <b>Not supported in core</b>\r
+ * @param {HTMLElement/String} root (optional) The root element of the query or id of the root\r
+ * @return {CompositeElementLite/CompositeElement}\r
+ * @member Ext.Element\r
+ * @method select\r
+ */\r
+Ext.Element.select = function(selector, unique, root){\r
+ var els;\r
+ if(typeof selector == "string"){\r
+ els = Ext.Element.selectorFunction(selector, root);\r
+ }else if(selector.length !== undefined){\r
+ els = selector;\r
+ }else{\r
+ throw "Invalid selector";\r
+ }\r
+ return new Ext.CompositeElementLite(els);\r
+};\r
+<div id="method-Ext-select"></div>/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or\r
+ * {@link Ext.CompositeElementLite CompositeElementLite} object.\r
+ * @param {String/Array} selector The CSS selector or an array of elements\r
+ * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)\r
+ * @param {HTMLElement/String} root (optional) The root element of the query or id of the root\r
+ * @return {CompositeElementLite/CompositeElement}\r
+ * @member Ext\r
+ * @method select\r
+ */\r
+Ext.select = Ext.Element.select;</pre> \r
+</body>\r
+</html>
\ No newline at end of file