</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.3.0
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
};
Ext.CompositeElementLite.prototype = {
- isComposite: true,
-
+ isComposite: true,
+
// private
getElement : function(el){
// Set the shared flyweight dom property to the current element
e.id = el.id;
return e;
},
-
+
// private
transformElement : function(el){
return Ext.getDom(el);
},
-
+
<div id="method-Ext.CompositeElementLite-getCount"></div>/**
* 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.
* @param {Mixed} els Either an Array of DOM elements to add, or another Composite object who's elements should be added.
if(!els){
return this;
}
- if(Ext.isString(els)){
+ if(typeof els == "string"){
els = Ext.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){
elements.push(me.transformElement(els[i]));
}
return me;
},
-
+
invoke : function(fn, args){
var me = this,
els = me.elements,
- len = els.length,
- e,
+ len = els.length,
+ e,
i;
-
+
for(i = 0; i < len; i++) {
e = els[i];
if(e){
var els = this.elements,
len = els.length,
i, e;
-
+
for(i = 0; i<len; i++) {
e = els[i];
if(e) {
* @param {Object} scope (optional) The scope (<i>this</i> reference) in which the function is executed. (defaults to the Element)
* @return {CompositeElement} this
*/
- each : function(fn, scope){
+ each : function(fn, scope){
var me = this,
els = me.elements,
len = els.length,
i, e;
-
+
for(i = 0; i<len; i++) {
e = els[i];
if(e){
}
return me;
},
-
+
<div id="method-Ext.CompositeElementLite-fill"></div>/**
* 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.
me.add(els);
return me;
},
-
+
<div id="method-Ext.CompositeElementLite-filter"></div>/**
* Filters this composite to only elements that match the passed selector.
* @param {String/Function} selector A string CSS selector or a comparison function.
filter : function(selector){
var els = [],
me = this,
- elements = me.elements,
fn = Ext.isFunction(selector) ? selector
: function(el){
return el.is(selector);
};
-
-
- me.each(function(el, self, i){
- if(fn(el, i) !== false){
+
+ me.each(function(el, self, i) {
+ if (fn(el, i) !== false) {
els[els.length] = me.transformElement(el);
}
});
+
me.elements = els;
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.
indexOf : function(el){
return this.elements.indexOf(this.transformElement(el));
},
-
+
<div id="method-Ext.CompositeElementLite-replaceElement"></div>/**
* 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
* @param {Mixed} replacement The id of an element or the Element itself.
* @param {Boolean} domReplace (Optional) True to remove and replace the element in the document too.
* @return {CompositeElement} this
- */
+ */
replaceElement : function(el, replacement, domReplace){
var index = !isNaN(el) ? el : this.indexOf(el),
d;
}
return this;
},
-
+
<div id="method-Ext.CompositeElementLite-clear"></div>/**
* Removes all elements.
*/
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
-(function(){
-var fnName,
- ElProto = Ext.Element.prototype,
- CelProto = Ext.CompositeElementLite.prototype;
-
-for(fnName in ElProto){
- if(Ext.isFunction(ElProto[fnName])){
- (function(fnName){
- CelProto[fnName] = CelProto[fnName] || function(){
- return this.invoke(fnName, arguments);
- };
- }).call(CelProto, fnName);
-
+/**
+ * @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
+ * are added in Ext JS
+ */
+Ext.CompositeElementLite.importElementMethods = function() {
+ var fnName,
+ ElProto = Ext.Element.prototype,
+ CelProto = Ext.CompositeElementLite.prototype;
+
+ for (fnName in ElProto) {
+ if (typeof ElProto[fnName] == 'function'){
+ (function(fnName) {
+ CelProto[fnName] = CelProto[fnName] || function() {
+ return this.invoke(fnName, arguments);
+ };
+ }).call(CelProto, fnName);
+
+ }
}
-}
-})();
+};
+
+Ext.CompositeElementLite.importElementMethods();
if(Ext.DomQuery){
Ext.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
* @member Ext
* @method select
*/
-Ext.select = Ext.Element.select;</pre>
+Ext.select = Ext.Element.select;
+</pre>
</body>
</html>
\ No newline at end of file