4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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.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){
58 <span id='Ext-Element-method-select'>/**
59 </span> * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
60 * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
61 * {@link Ext.CompositeElementLite CompositeElementLite} object.
62 * @param {String/HTMLElement[]} selector The CSS selector or an array of elements
63 * @param {Boolean} [unique] true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
64 * @param {HTMLElement/String} [root] The root element of the query or id of the root
65 * @return {Ext.CompositeElementLite/Ext.CompositeElement}
69 Ext.Element.select = function(selector, unique, root){
71 if(typeof selector == "string"){
72 els = Ext.Element.selectorFunction(selector, root);
73 }else if(selector.length !== undefined){
78 sourceClass: "Ext.Element",
79 sourceMethod: "select",
83 msg: "Invalid selector specified: " + selector
87 return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);
90 <span id='Ext-method-select'>/**
91 </span> * Shorthand of {@link Ext.Element#select}.
94 * @alias Ext.Element#select
96 Ext.select = Ext.Element.select;</pre>