3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.CompositeElement"></div>/**
16 * @class Ext.CompositeElement
17 * @extends Ext.CompositeElementLite
18 * <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter
19 * members, or to perform collective actions upon the whole set.</p>
20 * <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and
21 * {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>
22 * <p>All methods return <i>this</i> and can be chained.</p>
25 var els = Ext.select("#some-el div.some-class", true);
26 // or select directly from an existing element
27 var el = Ext.get('some-el');
28 el.select('div.some-class', true);
30 els.setWidth(100); // all elements become 100 width
31 els.hide(true); // all elements fade out and hide
33 els.setWidth(100).hide(true);
36 Ext.CompositeElement = Ext.extend(Ext.CompositeElementLite, {
38 constructor : function(els, root){
44 getElement : function(el){
45 // In this case just return it, since we already have a reference to it
50 transformElement : function(el){
55 * Adds elements to this composite.
56 * @param {String/Array} els A string CSS selector, an array of elements or an element
57 * @return {CompositeElement} this
61 * Returns the Element object at the specified index
62 * @param {Number} index
63 * @return {Ext.Element}
66 <div id="method-Ext.CompositeElement-"></div>/**
67 * Iterates each <code>element</code> in this <code>composite</code>
68 * calling the supplied function using {@link Ext#each}.
69 * @param {Function} fn The function to be called with each
70 * <code>element</code>. If the supplied function returns <tt>false</tt>,
71 * iteration stops. This function is called with the following arguments:
72 * <div class="mdetail-params"><ul>
73 * <li><code>element</code> : <i>Ext.Element</i><div class="sub-desc">The element at the current <code>index</code>
74 * in the <code>composite</code></div></li>
75 * <li><code>composite</code> : <i>Object</i> <div class="sub-desc">This composite.</div></li>
76 * <li><code>index</code> : <i>Number</i> <div class="sub-desc">The current index within the <code>composite</code> </div></li>
78 * @param {Object} scope (optional) The scope (<code><this</code> reference) in which the specified function is executed.
79 * Defaults to the <code>element</code> at the current <code>index</code>
80 * within the composite.
81 * @return {CompositeElement} this
85 <div id="method-Ext.Element-select"></div>/**
86 * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
87 * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
88 * {@link Ext.CompositeElementLite CompositeElementLite} object.
89 * @param {String/Array} selector The CSS selector or an array of elements
90 * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
91 * @param {HTMLElement/String} root (optional) The root element of the query or id of the root
92 * @return {CompositeElementLite/CompositeElement}
96 Ext.Element.select = function(selector, unique, root){
98 if(typeof selector == "string"){
99 els = Ext.Element.selectorFunction(selector, root);
100 }else if(selector.length !== undefined){
103 throw "Invalid selector";
106 return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);
109 <div id="method-Ext-select"></div>/**
110 * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
111 * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
112 * {@link Ext.CompositeElementLite CompositeElementLite} object.
113 * @param {String/Array} selector The CSS selector or an array of elements
114 * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
115 * @param {HTMLElement/String} root (optional) The root element of the query or id of the root
116 * @return {CompositeElementLite/CompositeElement}
120 Ext.select = Ext.Element.select;</pre>