4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-CompositeElement'>/**
19 </span> * @class Ext.CompositeElement
20 * @extends Ext.CompositeElementLite
21 * <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter
22 * members, or to perform collective actions upon the whole set.</p>
23 * <p>Although they are not listed, this class supports all of the methods of {@link Ext.core.Element} and
24 * {@link Ext.fx.Anim}. The methods from these classes will be performed on all the elements in this collection.</p>
25 * <p>All methods return <i>this</i> and can be chained.</p>
27 <pre><code>
28 var els = Ext.select("#some-el div.some-class", true);
29 // or select directly from an existing element
30 var el = Ext.get('some-el');
31 el.select('div.some-class', true);
33 els.setWidth(100); // all elements become 100 width
34 els.hide(true); // all elements fade out and hide
36 els.setWidth(100).hide(true);
37 </code></pre>
39 Ext.CompositeElement = Ext.extend(Ext.CompositeElementLite, {
41 constructor : function(els, root){
47 getElement : function(el){
48 // In this case just return it, since we already have a reference to it
53 transformElement : function(el){
57 <span id='Ext-CompositeElement-property-'> /**
58 </span> * Adds elements to this composite.
59 * @param {String/Array} els A string CSS selector, an array of elements or an element
60 * @return {CompositeElement} this
63 <span id='Ext-CompositeElement-property-'> /**
64 </span> * Returns the Element object at the specified index
65 * @param {Number} index
66 * @return {Ext.core.Element}
69 <span id='Ext-CompositeElement-property-'> /**
70 </span> * Iterates each `element` in this `composite` calling the supplied function using {@link Ext#each Ext.each}.
71 * @param {Function} fn
73 The function to be called with each
74 `element`. If the supplied function returns <tt>false</tt>,
75 iteration stops. This function is called with the following arguments:
77 - `element` : __Ext.core.Element++
78 The element at the current `index` in the `composite`
80 - `composite` : __Object__
83 - `index` : __Number__
84 The current index within the `composite`
86 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed.
87 * Defaults to the <code>element</code> at the current <code>index</code>
88 * within the composite.
89 * @return {CompositeElement} this
94 <span id='Ext-core-Element-method-select'>/**
95 </span> * Selects elements based on the passed CSS selector to enable {@link Ext.core.Element Element} methods
96 * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
97 * {@link Ext.CompositeElementLite CompositeElementLite} object.
98 * @param {String/Array} selector The CSS selector or an array of elements
99 * @param {Boolean} unique (optional) true to create a unique Ext.core.Element for each element (defaults to a shared flyweight object)
100 * @param {HTMLElement/String} root (optional) The root element of the query or id of the root
101 * @return {CompositeElementLite/CompositeElement}
102 * @member Ext.core.Element
105 Ext.core.Element.select = function(selector, unique, root){
107 if(typeof selector == "string"){
108 els = Ext.core.Element.selectorFunction(selector, root);
109 }else if(selector.length !== undefined){
114 sourceClass: "Ext.core.Element",
115 sourceMethod: "select",
119 msg: "Invalid selector specified: " + selector
123 return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);
126 <span id='Ext-method-select'>/**
127 </span> * Selects elements based on the passed CSS selector to enable {@link Ext.core.Element Element} methods
128 * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
129 * {@link Ext.CompositeElementLite CompositeElementLite} object.
130 * @param {String/Array} selector The CSS selector or an array of elements
131 * @param {Boolean} unique (optional) true to create a unique Ext.core.Element for each element (defaults to a shared flyweight object)
132 * @param {HTMLElement/String} root (optional) The root element of the query or id of the root
133 * @return {CompositeElementLite/CompositeElement}
137 Ext.select = Ext.core.Element.select;</pre>