Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / CompositeElementLite.html
index 7d95f8c..4e661bc 100644 (file)
@@ -1,25 +1,11 @@
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
-  <title>The source code</title>
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body  onload="prettyPrint();">
-    <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.3.1
- * Copyright(c) 2006-2010 Sencha Inc.
- * licensing@sencha.com
- * http://www.sencha.com/license
- */
-<div id="cls-Ext.CompositeElementLite"></div>/**
- * @class Ext.CompositeElementLite
- * <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter
- * members, or to perform collective actions upon the whole set.</p>
- * <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and
- * {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>
- * Example:<pre><code>
-var els = Ext.select("#some-el div.some-class");
+<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-CompositeElementLite'>/**
+</span> * @class Ext.CompositeElementLite
+ * &lt;p&gt;This class encapsulates a &lt;i&gt;collection&lt;/i&gt; of DOM elements, providing methods to filter
+ * members, or to perform collective actions upon the whole set.&lt;/p&gt;
+ * &lt;p&gt;Although they are not listed, this class supports all of the methods of {@link Ext.core.Element} and
+ * {@link Ext.fx.Anim}. The methods from these classes will be performed on all the elements in this collection.&lt;/p&gt;
+ * Example:&lt;pre&gt;&lt;code&gt;
+var els = Ext.select(&quot;#some-el div.some-class&quot;);
 // or select directly from an existing element
 var el = Ext.get('some-el');
 el.select('div.some-class');
@@ -28,23 +14,23 @@ els.setWidth(100); // all elements become 100 width
 els.hide(true); // all elements fade out and hide
 // or
 els.setWidth(100).hide(true);
-</code>
+&lt;/code&gt;&lt;/pre&gt;
  */
 Ext.CompositeElementLite = function(els, root){
-    <div id="prop-Ext.CompositeElementLite-elements"></div>/**
-     * <p>The Array of DOM elements which this CompositeElement encapsulates. Read-only.</p>
-     * <p>This will not <i>usually</i> be accessed in developers' code, but developers wishing
+<span id='Ext-CompositeElementLite-property-elements'>    /**
+</span>     * &lt;p&gt;The Array of DOM elements which this CompositeElement encapsulates. Read-only.&lt;/p&gt;
+     * &lt;p&gt;This will not &lt;i&gt;usually&lt;/i&gt; be accessed in developers' code, but developers wishing
      * to augment the capabilities of the CompositeElementLite class may use it when adding
-     * methods to the class.</p>
-     * <p>For example to add the <code>nextAll</code> method to the class to <b>add</b> all
-     * following siblings of selected elements, the code would be</p><code><pre>
+     * methods to the class.&lt;/p&gt;
+     * &lt;p&gt;For example to add the &lt;code&gt;nextAll&lt;/code&gt; method to the class to &lt;b&gt;add&lt;/b&gt; all
+     * following siblings of selected elements, the code would be&lt;/p&gt;&lt;code&gt;&lt;pre&gt;
 Ext.override(Ext.CompositeElementLite, {
     nextAll: function() {
         var els = this.elements, i, l = els.length, n, r = [], ri = -1;
 
 //      Loop through all elements in this Composite, accumulating
 //      an Array of all siblings.
-        for (i = 0; i < l; i++) {
+        for (i = 0; i &lt; l; i++) {
             for (n = els[i].nextSibling; n; n = n.nextSibling) {
                 r[++ri] = n;
             }
@@ -53,13 +39,13 @@ Ext.override(Ext.CompositeElementLite, {
 //      Add all found siblings to this Composite
         return this.add(r);
     }
-});</pre></code>
+});&lt;/pre&gt;&lt;/code&gt;
      * @type Array
      * @property elements
      */
     this.elements = [];
     this.add(els, root);
-    this.el = new Ext.Element.Flyweight();
+    this.el = new Ext.core.Element.Flyweight();
 };
 
 Ext.CompositeElementLite.prototype = {
@@ -79,15 +65,15 @@ Ext.CompositeElementLite.prototype = {
         return Ext.getDom(el);
     },
 
-    <div id="method-Ext.CompositeElementLite-getCount"></div>/**
-     * Returns the number of elements in this Composite.
+<span id='Ext-CompositeElementLite-method-getCount'>    /**
+</span>     * Returns the number of elements in this Composite.
      * @return Number
      */
     getCount : function(){
         return this.elements.length;
     },
-    <div id="method-Ext.CompositeElementLite-add"></div>/**
-     * Adds elements to this Composite object.
+<span id='Ext-CompositeElementLite-method-add'>    /**
+</span>     * Adds elements to this Composite object.
      * @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.
      */
@@ -97,15 +83,15 @@ Ext.CompositeElementLite.prototype = {
         if(!els){
             return this;
         }
-        if(typeof els == "string"){
-            els = Ext.Element.selectorFunction(els, root);
+        if(typeof els == &quot;string&quot;){
+            els = Ext.core.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){
+        for(var i = 0, len = els.length; i &lt; len; ++i){
             elements.push(me.transformElement(els[i]));
         }
         return me;
@@ -118,18 +104,18 @@ Ext.CompositeElementLite.prototype = {
             e,
             i;
 
-        for(i = 0; i < len; i++) {
+        for(i = 0; i &lt; len; i++) {
             e = els[i];
             if(e){
-                Ext.Element.prototype[fn].apply(me.getElement(e), args);
+                Ext.core.Element.prototype[fn].apply(me.getElement(e), args);
             }
         }
         return me;
     },
-    <div id="method-Ext.CompositeElementLite-item"></div>/**
-     * Returns a flyweight Element of the dom element object at the specified index
+<span id='Ext-CompositeElementLite-method-item'>    /**
+</span>     * Returns a flyweight Element of the dom element object at the specified index
      * @param {Number} index
-     * @return {Ext.Element}
+     * @return {Ext.core.Element}
      */
     item : function(index){
         var me = this,
@@ -148,7 +134,7 @@ Ext.CompositeElementLite.prototype = {
             len = els.length,
             i, e;
 
-        for(i = 0; i<len; i++) {
+        for(i = 0; i&lt;len; i++) {
             e = els[i];
             if(e) {
                 Ext.EventManager.on(e, eventName, handler, scope || e, opt);
@@ -156,16 +142,16 @@ Ext.CompositeElementLite.prototype = {
         }
         return this;
     },
-    <div id="method-Ext.CompositeElementLite-each"></div>/**
-     * <p>Calls the passed function for each element in this composite.</p>
-     * @param {Function} fn The function to call. The function is passed the following parameters:<ul>
-     * <li><b>el</b> : Element<div class="sub-desc">The current Element in the iteration.
-     * <b>This is the flyweight (shared) Ext.Element instance, so if you require a
-     * a reference to the dom node, use el.dom.</b></div></li>
-     * <li><b>c</b> : Composite<div class="sub-desc">This Composite object.</div></li>
-     * <li><b>idx</b> : Number<div class="sub-desc">The zero-based index in the iteration.</div></li>
-     * </ul>
-     * @param {Object} scope (optional) The scope (<i>this</i> reference) in which the function is executed. (defaults to the Element)
+<span id='Ext-CompositeElementLite-method-each'>    /**
+</span>     * &lt;p&gt;Calls the passed function for each element in this composite.&lt;/p&gt;
+     * @param {Function} fn The function to call. The function is passed the following parameters:&lt;ul&gt;
+     * &lt;li&gt;&lt;b&gt;el&lt;/b&gt; : Element&lt;div class=&quot;sub-desc&quot;&gt;The current Element in the iteration.
+     * &lt;b&gt;This is the flyweight (shared) Ext.core.Element instance, so if you require a
+     * a reference to the dom node, use el.dom.&lt;/b&gt;&lt;/div&gt;&lt;/li&gt;
+     * &lt;li&gt;&lt;b&gt;c&lt;/b&gt; : Composite&lt;div class=&quot;sub-desc&quot;&gt;This Composite object.&lt;/div&gt;&lt;/li&gt;
+     * &lt;li&gt;&lt;b&gt;idx&lt;/b&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The zero-based index in the iteration.&lt;/div&gt;&lt;/li&gt;
+     * &lt;/ul&gt;
+     * @param {Object} scope (optional) The scope (&lt;i&gt;this&lt;/i&gt; reference) in which the function is executed. (defaults to the Element)
      * @return {CompositeElement} this
      */
     each : function(fn, scope){
@@ -174,7 +160,7 @@ Ext.CompositeElementLite.prototype = {
             len = els.length,
             i, e;
 
-        for(i = 0; i<len; i++) {
+        for(i = 0; i&lt;len; i++) {
             e = els[i];
             if(e){
                 e = this.getElement(e);
@@ -186,8 +172,8 @@ Ext.CompositeElementLite.prototype = {
         return me;
     },
 
-    <div id="method-Ext.CompositeElementLite-fill"></div>/**
-    * Clears this Composite and adds the elements passed.
+<span id='Ext-CompositeElementLite-method-fill'>    /**
+</span>    * Clears this Composite and adds the elements passed.
     * @param {Mixed} els Either an array of DOM elements, or another Composite from which to fill this Composite.
     * @return {CompositeElement} this
     */
@@ -198,13 +184,13 @@ Ext.CompositeElementLite.prototype = {
         return me;
     },
 
-    <div id="method-Ext.CompositeElementLite-filter"></div>/**
-     * Filters this composite to only elements that match the passed selector.
+<span id='Ext-CompositeElementLite-method-filter'>    /**
+</span>     * Filters this composite to only elements that match the passed selector.
      * @param {String/Function} selector A string CSS selector or a comparison function.
-     * The comparison function will be called with the following arguments:<ul>
-     * <li><code>el</code> : Ext.Element<div class="sub-desc">The current DOM element.</div></li>
-     * <li><code>index</code> : Number<div class="sub-desc">The current index within the collection.</div></li>
-     * </ul>
+     * The comparison function will be called with the following arguments:&lt;ul&gt;
+     * &lt;li&gt;&lt;code&gt;el&lt;/code&gt; : Ext.core.Element&lt;div class=&quot;sub-desc&quot;&gt;The current DOM element.&lt;/div&gt;&lt;/li&gt;
+     * &lt;li&gt;&lt;code&gt;index&lt;/code&gt; : Number&lt;div class=&quot;sub-desc&quot;&gt;The current index within the collection.&lt;/div&gt;&lt;/li&gt;
+     * &lt;/ul&gt;
      * @return {CompositeElement} this
      */
     filter : function(selector){
@@ -225,17 +211,17 @@ Ext.CompositeElementLite.prototype = {
         return me;
     },
 
-    <div id="method-Ext.CompositeElementLite-indexOf"></div>/**
-     * Find the index of the passed element within the composite collection.
-     * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.
-     * @return Number The index of the passed Ext.Element in the composite collection, or -1 if not found.
+<span id='Ext-CompositeElementLite-method-indexOf'>    /**
+</span>     * Find the index of the passed element within the composite collection.
+     * @param el {Mixed} The id of an element, or an Ext.core.Element, or an HtmlElement to find within the composite collection.
+     * @return Number The index of the passed Ext.core.Element in the composite collection, or -1 if not found.
      */
     indexOf : function(el){
-        return this.elements.indexOf(this.transformElement(el));
+        return Ext.Array.indexOf(this.elements, this.transformElement(el));
     },
 
-    <div id="method-Ext.CompositeElementLite-replaceElement"></div>/**
-    * Replaces the specified element with the passed element.
+<span id='Ext-CompositeElementLite-method-replaceElement'>    /**
+</span>    * Replaces the specified element with the passed element.
     * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite
     * to replace.
     * @param {Mixed} replacement The id of an element or the Element itself.
@@ -245,7 +231,7 @@ Ext.CompositeElementLite.prototype = {
     replaceElement : function(el, replacement, domReplace){
         var index = !isNaN(el) ? el : this.indexOf(el),
             d;
-        if(index > -1){
+        if(index &gt; -1){
             replacement = Ext.getDom(replacement);
             if(domReplace){
                 d = this.elements[index];
@@ -257,8 +243,8 @@ Ext.CompositeElementLite.prototype = {
         return this;
     },
 
-    <div id="method-Ext.CompositeElementLite-clear"></div>/**
-     * Removes all elements.
+<span id='Ext-CompositeElementLite-method-clear'>    /**
+</span>     * Removes all elements.
      */
     clear : function(){
         this.elements = [];
@@ -267,15 +253,15 @@ Ext.CompositeElementLite.prototype = {
 
 Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
 
-/**
- * @private
- * Copies all of the functions from Ext.Element's prototype onto CompositeElementLite's prototype.
- * This is called twice - once immediately below, and once again after additional Ext.Element
+<span id='Ext-CompositeElementLite-method-importElementMethods'>/**
+</span> * @private
+ * Copies all of the functions from Ext.core.Element's prototype onto CompositeElementLite's prototype.
+ * This is called twice - once immediately below, and once again after additional Ext.core.Element
  * are added in Ext JS
  */
 Ext.CompositeElementLite.importElementMethods = function() {
     var fnName,
-        ElProto = Ext.Element.prototype,
+        ElProto = Ext.core.Element.prototype,
         CelProto = Ext.CompositeElementLite.prototype;
 
     for (fnName in ElProto) {
@@ -293,32 +279,40 @@ Ext.CompositeElementLite.importElementMethods = function() {
 Ext.CompositeElementLite.importElementMethods();
 
 if(Ext.DomQuery){
-    Ext.Element.selectorFunction = Ext.DomQuery.select;
+    Ext.core.Element.selectorFunction = Ext.DomQuery.select;
 }
 
-<div id="method-Ext.Element-select"></div>/**
- * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
+<span id='Ext-core.Element-method-select'>/**
+</span> * Selects elements based on the passed CSS selector to enable {@link Ext.core.Element Element} methods
  * 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 {HTMLElement/String} root (optional) The root element of the query or id of the root
  * @return {CompositeElementLite/CompositeElement}
- * @member Ext.Element
+ * @member Ext.core.Element
  * @method select
  */
-Ext.Element.select = function(selector, root){
+Ext.core.Element.select = function(selector, root){
     var els;
-    if(typeof selector == "string"){
-        els = Ext.Element.selectorFunction(selector, root);
+    if(typeof selector == &quot;string&quot;){
+        els = Ext.core.Element.selectorFunction(selector, root);
     }else if(selector.length !== undefined){
         els = selector;
     }else{
-        throw "Invalid selector";
+        //&lt;debug&gt;
+        Ext.Error.raise({
+            sourceClass: &quot;Ext.core.Element&quot;,
+            sourceMethod: &quot;select&quot;,
+            selector: selector,
+            root: root,
+            msg: &quot;Invalid selector specified: &quot; + selector
+        });
+        //&lt;/debug&gt;
     }
     return new Ext.CompositeElementLite(els);
 };
-<div id="method-Ext-select"></div>/**
- * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
+<span id='Ext-method-select'>/**
+</span> * Selects elements based on the passed CSS selector to enable {@link Ext.core.Element Element} methods
  * 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
@@ -327,7 +321,5 @@ Ext.Element.select = function(selector, root){
  * @member Ext
  * @method select
  */
-Ext.select = Ext.Element.select;
-</pre>    
-</body>
-</html>
\ No newline at end of file
+Ext.select = Ext.core.Element.select;
+</pre></pre></body></html>
\ No newline at end of file