Print Friendly

# Class YAHOO.ext.CompositeElement

Package: | YAHOO.ext
Class: | CompositeElement
Extends: | Object
Subclasses: | CompositeElementLite
Defined In: | CompositeElement.js

Standard composite class. Creates a YAHOO.ext.Element for every element in the collection.
NOTE: Although they are not listed, this class supports all of the set/update methods of YAHOO.ext.Element. All YAHOO.ext.Element actions will be performed on all the elements in this collection.
All methods return this and can be chained.

     var els = getEls('#some-el div.some-class');
     // or
     var els = YAHOO.ext.Element.select('#some-el div.some-class');
     els.setWidth(100); // all elements become 100 width
     els.hide(true); // all elements fade out and hide
     // or
     els.setWidth(100).hide(true);

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| add(`String/Array els`) : CompositeElement | CompositeElement
Adds elements to this composite.
| each(`Function fn`, [`Object scope`]) : CompositeElement | CompositeElement
Calls the passed function passing (el, this, index) for each element in this composite.

## Public Events

This class has no public events.

## Method Details

### add

`public function add(`String/Array els`)`
Adds elements to this composite.
Parameters:

- `els` : String/Array
  A string CSS selector, an array of elements or an element

Returns:

- `CompositeElement`
  this

This method is defined by CompositeElement.

### each

`public function each(`Function fn`, [`Object scope`])`
Calls the passed function passing (el, this, index) for each element in this composite.
Parameters:

- `fn` : Function
  The function to call
- `scope` : Object
  (optional) The this object (defaults to the element)

Returns:

- `CompositeElement`
  this

This method is defined by CompositeElement.

Copyright © 2006 Jack Slocum. All rights reserved.