Print Friendly

# Class Ext.Element

Package: | Ext
Class: | Element
Extends: | Object
Subclasses: | Layer
Defined In: | Element.js

Represents an Element in the DOM.
Usage:

    var el = Ext.get("my-div");

    // or with getEl
    var el = getEl("my-div");

    // or with a DOM element
    var el = Ext.get(myDivElement);

Using Ext.get() or getEl() instead of calling the constructor directly ensures you get the same object each call instead of constructing a new one.
Animations
Many of the functions for manipulating an element have an optional "animate" parameter. The animate parameter should either be a boolean (true) or an object literal with animation options. The animation options are:

    Option    Default   Description
    --------- --------  ---------------------------------------------
    duration  .35       The duration of the animation in seconds
    easing    easeOut   The YUI easing method
    callback  none      A function to execute when the anim completes
    scope     this      The scope (this) of the callback function

Also, the Anim object being used for the animation will be set on your options object as "anim", which allows you to stop or manipulate the animation. Here's an example:

    var el = Ext.get("my-div");

    // no animation
    el.setWidth(100);

    // default animation
    el.setWidth(100, true);

    // animation with some options set
    el.setWidth(100, {
        duration: 1,
        callback: this.foo,
        scope: this
    });

    // using the "anim" property to get the Anim object
    var opt = {
        duration: 1,
        callback: this.foo,
        scope: this
    };
    el.setWidth(100, opt);
    ...
    if(opt.anim.isAnimated()){
        opt.anim.stop();
    }

Composite (Collections of) Elements
For working with collections of Elements, see Ext.CompositeElement
Properties - Methods - Events

## Public Properties

Property | Defined By
--- | ---
| Element.DISPLAY : Number | Element
<static> Visibility mode constant - Use display to hide element
| Element.VISIBILITY : Number | Element
<static> Visibility mode constant - Use visibility to hide element
| defaultUnit : String | Element
The default unit to append to CSS values where a unit isn't provided (Defaults to px).
| dom : HTMLElement | Element
The DOM element
| id : String | Element
The DOM element ID
| originalDisplay : String | Element
The element's default display mode

## Public Methods

Method | Defined By
--- | ---
| Element(`String/HTMLElement element`, [`Boolean forceNew`]) | Element
Create a new Element directly.
| Element.fly(`String/HTMLElement el`, [`String named`]) : Element | Element
<static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a...
| Element.get(`String/HTMLElement/Element el`) : Element | Element
<static> Static method to retrieve Element objects. Uses simple caching to consistently return the same object....
| addClass(`String/Array className`) : Ext.Element | Element
Add a CSS class to the element.
| addClassOnClick(`String className`) : Ext.Element | Element
Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
| addClassOnFocus(`String className`) : Ext.Element | Element
Sets up event handlers to add and remove a css class when this element has the focus
| addClassOnOver(`String className`, [`Boolean preventFlicker`]) : Ext.Element | Element
Sets up event handlers to add and remove a css class when the mouse is over this element
| addKeyListener(`Number/Array/Object/String key`, `Function fn`, [`Object scope`]) : Ext.KeyMap | Element
Convenience method for constructing a KeyMap
| addKeyMap(`Object config`) : Ext.KeyMap | Element
Creates a KeyMap for this element
| addListener(`String eventName`, `Function fn`, [`Object scope`], [`Object options`]) : void | Element
Appends an event handler
| alignTo(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`], [`Boolean/Object animate`]) : Ext.Element | Element
Aligns this element with another element relative to the specified anchor points. If the other element is the documen...
| anchorTo(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`], [`Boolean/Object animate`], [`Boolean/Number monitorScroll`], `` ) : void | Element
Anchors an element to another element and realigns it when the window is resized.
| animate(`Object args`, [`Float duration`], [`Function onComplete`], [`String easing`], [`String animType`]) : Ext.Element | Element
Perform animation on this element.
| appendChild(`String/HTMLElement/Array/Element/CompositeElement el`) : Ext.Element | Element
Appends the passed element(s) to this element
| appendTo(`String/HTMLElement/Element el`) : Ext.Element | Element
Appends this element to the passed element
| applyStyles(`String/Object/Function styles`) : Ext.Element | Element
More flexible version of setStyle for setting style properties.
| autoHeight([`Boolean animate`], [`Float duration`], [`Function onComplete`], [`String easing`]) : Ext.Element | Element
Measures the elements content height and updates height to match. Note, this function uses setTimeout and the new he...
| beginMeasure() : Ext.Element | Element
Temporarily enables offsets (width,height,x,y) for an element with display:none, use endMeasure() when done.
| blur() : Ext.Element | Element
Tries to blur the element. Any exceptions are caught.
| center([`String/HTMLElement/Ext.Element centerIn`]) : void | Element
Centers the Element in either the viewport, or another Element.
| child(`String selector`, `Boolean returnDom`) : Element | Element
Selects a single child based on the passed CSS selector (the selector should not contain an id)
| clean([`Boolean forceReclean`]) : void | Element
Removes worthless text nodes
| clearOpacity() : Ext.Element | Element
Clears any opacity settings from this element. Required in some cases for IE.
| clearPositioning([`String value`]) : Ext.Element | Element
Clear positioning back to the default when the document was loaded
| clip() : Ext.Element | Element
Store the current overflow setting and clip overflow on the element - use unclip to remove
| contains(`HTMLElement/String el`) : Boolean | Element
Returns true if this element is an ancestor of the passed element
| createChild(`Object config`, [`HTMLElement insertBefore`], [`Boolean returnDom`]) : Ext.Element | Element
Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child e...
| createProxy(`String/Object config`, [`String/HTMLElement renderTo`], [`Boolean matchBox`]) : Ext.Element | Element
Creates a proxy element of this element
| createShim() : Ext.Element | Element
Creates an iframe shim for this element to keep selects and other windowed objects from showing through.
| down(`String selector`, `Boolean returnDom`) : Element | Element
Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id)
| enableDisplayMode([`String display`]) : Ext.Element | Element
Convenience method for setVisibilityMode(Element.DISPLAY)
| endMeasure() : Ext.Element | Element
Restores displays to before beginMeasure was called
| findParent(`String ss`, [`Number/String/HTMLElement/Element maxDepth`], [`Boolean returnEl`]) : HTMLElement | Element
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:fi...
| findParentNode(`String ss`, [`Number/String/HTMLElement/Element maxDepth`], [`Boolean returnEl`]) : HTMLElement | Element
Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
| fitToParent([`Boolean monitorResize`], [`String/HTMLElment/Element targetParent`]) : Ext.Element | Element
Sizes this element to its parent element's dimensions performing neccessary box adjustments.
| focus() : Ext.Element | Element
Tries to focus the element. Any exceptions are caught.
| getAlignToXY(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`]) : Array | Element
Gets the x,y coordinates to align this element with another element. See alignTo for more info on the supported posit...
| getAnchorXY([`String anchor`], [`Object size`], [`Boolean local`]) : Array | Element
Gets the x,y coordinates specified by the anchor position on the element.
| getBorderWidth(`String side`) : Number | Element
Gets the width of the border(s) for the specified side(s)
| getBottom(`Boolean local`) : Number | Element
Gets the bottom Y coordinate of the element (element Y position + element height)
| getBox([`Boolean contentBox`], [`Boolean local`]) : Object | Element
Return a box {x, y, width, height} that can be used to set another elements size/location to match this element.
| getCenterXY() : Array | Element
Calculates the x, y to center this element on the screen
| getColor(`String attr`, `String defaultValue`, [`String prefix`]) : void | Element
Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values are convert to standa...
| getComputedHeight() : Number | Element
Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders when...
| getComputedWidth() : Number | Element
Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders when ne...
| getFrameWidth(`String sides`) : Number | Element
Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth() for more informat...
| getHeight([`Boolean contentHeight`]) : Number | Element
Returns the offset height of the element
| getLeft(`Boolean local`) : Number | Element
Gets the left X coordinate
| getMargins([`String sides`]) : Object/Number | Element
Returns an object with properties top, left, right and bottom representing the margins of this element unless sides i...
| getNextSibling() : HTMLElement | Element
Gets the next sibling, skipping text nodes
| getPadding(`String side`) : Number | Element
Gets the width of the padding(s) for the specified side(s)
| getPositioning() : Object | Element
Gets an object with all CSS positioning properties. Useful along with setPostioning to get snapshot before performing...
| getPrevSibling() : HTMLElement | Element
Gets the previous sibling, skipping text nodes
| getRegion() : Region | Element
Returns the region of the given element. The element must be part of the DOM tree to have a region (display:none or e...
| getRight(`Boolean local`) : Number | Element
Gets the right X coordinate of the element (element X position + element width)
| getSize([`Boolean contentSize`]) : Object | Element
Returns the size of the element
| getStyle(`String property`) : String | Element
Normalizes currentStyle and computedStyle. This is not YUI getStyle, it is an optimised version.
| getStyles(`String style1`, `String style2`, `String etc`) : Object | Element
Get an object with properties matching the styles requested. e.g. el.getStyles('color', 'font-size', 'width') might r...
| getTop(`Boolean local`) : Number | Element
Gets the top Y coordinate
| getUpdateManager() : Ext.UpdateManager | Element
Gets this elements UpdateManager
| getValue(`Boolean asNumber`) : String/Number | Element
Returns the value of the "value" attribute
| getWidth([`Boolean contentWidth`]) : Number | Element
Returns the offset width of the element
| getX() : Number | Element
Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have p...
| getXY() : Array | Element
Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have pag...
| getY() : Number | Element
Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have p...
| hasClass(`String className`) : Boolean | Element
Checks if a CSS class is in use by the element.
| hide([`Boolean/Object animate`]) : Ext.Element | Element
Hide this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
| initDD(`String group`, `Object config`, `Object overrides`) : Ext.dd.DD | Element
Initializes a Ext.dd.DD object for this element.
| initDDProxy(`String group`, `Object config`, `Object overrides`) : Ext.dd.DDProxy | Element
Initializes a Ext.dd.DDProxy object for this element.
| initDDTarget(`String group`, `Object config`, `Object overrides`) : Ext.dd.DDTarget | Element
Initializes a Ext.dd.DDTarget object for this element.
| insertAfter(`String/HTMLElement/Element el`) : Ext.Element | Element
Inserts this element after the passed element in the DOM
| insertBefore(`String/HTMLElement/Element el`) : Ext.Element | Element
Inserts this element before the passed element in the DOM
| insertFirst(`String/HTMLElement/Element/Object el`) : Ext.Element | Element
Inserts (or creates) an element (or DomHelper config) as the first child of the this element
| insertHtml(`String where`, `String html`) : HTMLElement | Element
Inserts an html fragment into this element
| insertSibling(`String/HTMLElement/Element/Object el`, [`String where`], [`Boolean returnDom`]) : Ext.Element | Element
Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
| is(`String ss`) : Boolean | Element
Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
| isBorderBox() : Boolean | Element
Tests various css rules/browsers to determine if this element uses a border box
| isDisplayed() : Boolean | Element
Returns true if display is not "none"
| isMasked() : Boolean | Element
Returns true if this element is masked
| isScrollable() : Boolean | Element
Returns true if this element is scrollable.
| isVisible(`Boolean deep`) : Boolean | Element
Checks whether the element is currently visible using both visibility and display properties.
| load(`String/Function url`, [`String/Object params`], [`Function callback`], [`Boolean discardUrl`]) : Ext.Element | Element
Direct access to the UpdateManager update() method (takes the same parameters).
| mask([`String msg`], [`String msgCls`]) : Element | Element
Puts a mask over this element to disable user interaction. Requires core.css. This method can only be applied to elem...
| move(`String direction`, `Number distance`, [`Boolean/Object animate`]) : Ext.Element | Element
Move this element relative to its current position.
| moveTo(`Number x`, `Number y`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be...
| position([`String pos`], [`Number zIndex`], [`Number x`], [`Number y`]) : void | Element
Initializes positioning on this element. If a desired position is not passed, it will make the the element positioned...
| query(`String selector`) : Array | Element
Selects child nodes based on the passed CSS selector (the selector should not contain an id)
| radioClass(`String className`) : Ext.Element | Element
Adds the passed className to this element and removes the class from all siblings
| remove() : void | Element
Removes this element from the DOM and deletes it from the cache
| removeAllListeners() : Ext.Element | Element
Removes all previous added listeners from this element
| removeClass(`String/Array className`) : Ext.Element | Element
Removes a CSS class from the element.
| removeListener(`String eventName`, `Function fn`) : Ext.Element | Element
Removes an event handler from this element
| repaint() : Ext.Element | Element
Forces the browser to repaint this element
| replace(`String/HTMLElement/Element el`) : Ext.Element | Element
Replaces the passed element with this element
| replaceClass(`String oldClassName`, `String newClassName`) : Ext.Element | Element
Replaces a CSS class on the element with another.
| scroll(`String direction`, `Number distance`, [`Boolean/Object animate`]) : Boolean | Element
Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this elements s...
| scrollIntoView([`String/HTMLElement/Element container`], [`Boolean hscroll`]) : Ext.Element | Element
Scrolls this element into view within the passed container.
| scrollTo(`String side`, `Number value`, [`Boolean/Object animate`]) : Element | Element
Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it ...
| select(`String selector`, `Boolean unique`) : CompositeElement/CompositeElementLite | Element
Creates a CompositeElement for child nodes based on the passed CSS selector (the selector should not contain an id)
| set(`Object o`, [`Boolean useSet`]) : Ext.Element | Element
Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
| setBottom(`String bottom`) : Ext.Element | Element
Set the element's css bottom style
| setBounds(`Number x`, `Number y`, `Number width`, `Number height`, [`Boolean/Object animate`]) : Ext.Element | Element
Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated c...
| setBox(`Object box`, [`Boolean adjust`], [`Boolean/Object animate`]) : Ext.Element | Element
Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x an...
| setDisplayed(`Boolean value`) : Ext.Element | Element
Sets the css display. Uses originalDisplay if value is a boolean true.
| setHeight(`Number height`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the height of the element
| setLeft(`String left`) : Ext.Element | Element
Set the element's left position directly using CSS style (instead of setX())
| setLeftTop() : Ext.Element | Element
Quick set left and top adding default units
| setLocation(`Number x`, `Number y`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be...
| setOpacity(`Float opacity`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the opacity of the element
| setPositioning(`Object posCfg`) : Ext.Element | Element
Set positioning with an object returned by getPositioning().
| setRegion(`Ext.lib.Region region`, [`Boolean/Object animate`]) : Ext.Element | Element
Sets the element's position and size the the specified region. If animation is true then width, height, x and y will ...
| setRight(`String right`) : Ext.Element | Element
Set the element's css right style
| setSize(`Number width`, `Number height`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the size of the element. If animation is true, both width an height will be animated concurrently.
| setStyle(`String/Object property`, [`String val`]) : Ext.Element | Element
Wrapper for setting style properties, also takes single object parameter of multiple styles
| setTop(`String top`) : Ext.Element | Element
Set the element's top position directly using CSS style (instead of setY())
| setVisibilityMode(`visMode Element.VISIBILITY`) : Ext.Element | Element
Sets the elements visibility mode. When setVisible() is called it will use this to determine whether to set the visib...
| setVisible(`Boolean visible`, [`Boolean/Object animate`]) : Ext.Element | Element
Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use the d...
| setWidth(`Number width`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the width of the element
| setX(`Number The`, [`Boolean/Object animate`]) : Ext.Element | Element
Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coor...
| setXY(`Array pos`, [`Boolean/Object animate`]) : Ext.Element | Element
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be...
| setY(`Number The`, [`Boolean/Object animate`]) : Ext.Element | Element
Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coor...
| show([`Boolean/Object animate`]) : Ext.Element | Element
Show this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
| swallowEvent(`String eventName`, [`Boolean preventDefault`]) : Ext.Element | Element
Stops the specified event from bubbling and optionally prevents the default action
| toggle([`Boolean/Object animate`]) : Ext.Element | Element
Toggles the elements visibility or display, depending on visibility mode.
| toggleClass(`String className`) : Ext.Element | Element
Toggles (adds or removes) the passed class.
| translatePoints(`Number/Array x`, `Number y`, `Object An`) : void | Element
Translates the passed page coordinates into left/top css values for this element
| unclip() : Ext.Element | Element
Return clipping (overflow) to original clipping before clip() was called
| unmask() : void | Element
Removes a previously applied mask. If removeEl is true the mask overlay is destroyed, otherwise it is cached for reuse.
| unselectable() : Ext.Element | Element
Disables text selection for this element (normalized across browsers)
| up(`String ss`, [`Number/String/HTMLElement/Element maxDepth`]) : Ext.Element | Element
Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first...
| update(`String html`, [`Boolean loadScripts`], `Function callback`) : Ext.Element | Element
Update the innerHTML of this element, optionally searching for and processing scripts
| wrap([`Object config`], [`Boolean returnDom`]) : /HTMLElementElement | Element
Creates and wraps this element with another element

## Public Events

This class has no public events.

## Property Details

### Element.DISPLAY

`public Number Element.DISPLAY`
<static> Visibility mode constant - Use display to hide element
This property is defined by Element.

### Element.VISIBILITY

`public Number Element.VISIBILITY`
<static> Visibility mode constant - Use visibility to hide element
This property is defined by Element.

### defaultUnit

`public String defaultUnit`
The default unit to append to CSS values where a unit isn't provided (Defaults to px).
This property is defined by Element.

### dom

`public HTMLElement dom`
The DOM element
This property is defined by Element.

### id

`public String id`
The DOM element ID
This property is defined by Element.

### originalDisplay

`public String originalDisplay`
The element's default display mode
This property is defined by Element.

## Constructor Details

### Element

`public function Element(`String/HTMLElement element`, [`Boolean forceNew`])`
Create a new Element directly.
Parameters:

- `element` : String/HTMLElement
- `forceNew` : Boolean
  (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).

## Method Details

### Element.fly

`public function Element.fly(`String/HTMLElement el`, [`String named`])`
<static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element - the dom node can be overwritten by other code.
Parameters:

- `el` : String/HTMLElement
  The dom node or id
- `named` : String
  (optional) Allows for creation of named reusable flyweights to prevent conflicts (e.g. internally Ext uses "_internal")

Returns:

- `Element`
  The shared Element object

This method is defined by Element.

### Element.get

`public function Element.get(`String/HTMLElement/Element el`)`
<static> Static method to retrieve Element objects. Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with the same id via AJAX or DOM.
Parameters:

- `el` : String/HTMLElement/Element
  The id of the node, a DOM Node or an existing Element.

Returns:

- `Element`
  The Element object

This method is defined by Element.

### addClass

`public function addClass(`String/Array className`)`
Add a CSS class to the element.
Parameters:

- `className` : String/Array
  The CSS class to add or an array of classes

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### addClassOnClick

`public function addClassOnClick(`String className`)`
Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
Parameters:

- `className` : String

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### addClassOnFocus

`public function addClassOnFocus(`String className`)`
Sets up event handlers to add and remove a css class when this element has the focus
Parameters:

- `className` : String

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### addClassOnOver

`public function addClassOnOver(`String className`, [`Boolean preventFlicker`])`
Sets up event handlers to add and remove a css class when the mouse is over this element
Parameters:

- `className` : String
- `preventFlicker` : Boolean
  (optional) If set to true, it prevents flickering by filtering mouseout events for children elements

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### addKeyListener

`public function addKeyListener(`Number/Array/Object/String key`, `Function fn`, [`Object scope`])`
Convenience method for constructing a KeyMap
Parameters:

- `key` : Number/Array/Object/String
  Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options: {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}
- `fn` : Function
  The function to call
- `scope` : Object
  (optional) The scope of the function

Returns:

- `Ext.KeyMap`
  The KeyMap created

This method is defined by Element.

### addKeyMap

`public function addKeyMap(`Object config`)`
Creates a KeyMap for this element
Parameters:

- `config` : Object
  The KeyMap config. See Ext.KeyMap for more details

Returns:

- `Ext.KeyMap`
  The KeyMap created

This method is defined by Element.

### addListener

`public function addListener(`String eventName`, `Function fn`, [`Object scope`], [`Object options`])`
Appends an event handler
Parameters:

- `eventName` : String
  The type of event to append
- `fn` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) of the fn
- `options` : Object
  (optional)An object with standard EventManager options

Returns:

- `void`

This method is defined by Element.

### alignTo

`public function alignTo(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`], [`Boolean/Object animate`])`
Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport. The position parameter is optional, and can be specified in any one of the following formats:

- Blank: Defaults to aligning the element"s top-left corner to the target"s bottom-left corner ("tl-bl").
- One anchor (deprecated): The passed anchor position is used as the target element's anchor point. The element being aligned will position its top-left corner (tl) to that point. This method has been deprecated in favor of the newer two anchor syntax below.
- Two anchors: If two values from the table below are passed separated by a dash, the first value is used as the element"s anchor point, and the second value is used as the target"s anchor point.

In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to the viewport if necessary. Note that the element being aligned might be swapped to align to a different position than that specified in order to enforce the viewport constraints. Following are all of the supported anchor positions:

    Value  Description
    -----  -----------------------------
    tl     The top left corner (default)
    t      The center of the top edge
    tr     The top right corner
    l      The center of the left edge
    c      In the center of the element
    r      The center of the right edge
    bl     The bottom left corner
    b      The center of the bottom edge
    br     The bottom right corner

Example Usage:

    // align el to other-el using the default positioning ("tl-bl", non-constrained)
    el.alignTo("other-el");

    // align the top left corner of el with the top right corner of other-el (constrained to viewport)
    el.alignTo("other-el", "tr?");

    // align the bottom right corner of el with the center left edge of other-el
    el.alignTo("other-el", "br-l?");

    // align the center of el with the bottom left corner of other-el and
    // adjust the x position by -6 pixels (and the y position by 0)
    el.alignTo("other-el", "c-bl", [-6, 0]);

Parameters:

- `element` : String/HTMLElement/Ext.Element
  The element to align to.
- `position` : String
  The position to align to.
- `offsets` : Array
  (optional) Offset the positioning by [x, y]
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### anchorTo

`public function anchorTo(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`], [`Boolean/Object animate`], [`Boolean/Number monitorScroll`], `` )`
Anchors an element to another element and realigns it when the window is resized.
Parameters:

- `element` : String/HTMLElement/Ext.Element
  The element to align to.
- `position` : String
  The position to align to.
- `offsets` : Array
  (optional) Offset the positioning by [x, y]
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object
- `monitorScroll` : Boolean/Number
  (optional) true to monitor body scroll and reposition. If this parameter is a number, it is used as the buffer delay (defaults to 50ms).
- `` :

Returns:

- `void`

This method is defined by Element.

### animate

`public function animate(`Object args`, [`Float duration`], [`Function onComplete`], [`String easing`], [`String animType`])`
Perform animation on this element.
Parameters:

- `args` : Object
  The YUI animation control args
- `duration` : Float
  (optional) How long the animation lasts. (Defaults to .35 seconds)
- `onComplete` : Function
  (optional) Function to call when animation completes.
- `easing` : String
  (optional) Easing method to use. (Defaults to 'easeOut')
- `animType` : String
  (optional) 'run' is the default. Can be 'color', 'motion', or 'scroll'

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### appendChild

`public function appendChild(`String/HTMLElement/Array/Element/CompositeElement el`)`
Appends the passed element(s) to this element
Parameters:

- `el` : String/HTMLElement/Array/Element/CompositeElement

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### appendTo

`public function appendTo(`String/HTMLElement/Element el`)`
Appends this element to the passed element
Parameters:

- `el` : String/HTMLElement/Element
  The new parent element

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### applyStyles

`public function applyStyles(`String/Object/Function styles`)`
More flexible version of setStyle for setting style properties.
Parameters:

- `styles` : String/Object/Function
  A style specification string eg "width:100px", or object in the form {width:"100px"}, or a function which returns such a specification.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### autoHeight

`public function autoHeight([`Boolean animate`], [`Float duration`], [`Function onComplete`], [`String easing`])`
Measures the elements content height and updates height to match. Note, this function uses setTimeout and the new height may not be available immediately.
Parameters:

- `animate` : Boolean
  (optional) Animate the transition (Default is false)
- `duration` : Float
  (optional) Length of the animation. (Defaults to .35 seconds)
- `onComplete` : Function
  (optional) Function to call when animation completes.
- `easing` : String
  (optional) Easing method to use.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### beginMeasure

`public function beginMeasure()`
Temporarily enables offsets (width,height,x,y) for an element with display:none, use endMeasure() when done.
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### blur

`public function blur()`
Tries to blur the element. Any exceptions are caught.
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### center

`public function center([`String/HTMLElement/Ext.Element centerIn`])`
Centers the Element in either the viewport, or another Element.
Parameters:

- `centerIn` : String/HTMLElement/Ext.Element
  (optional) The element in which to center the element.

Returns:

- `void`

This method is defined by Element.

### child

`public function child(`String selector`, `Boolean returnDom`)`
Selects a single child based on the passed CSS selector (the selector should not contain an id)
Parameters:

- `selector` : String
  The CSS selector
- `returnDom` : Boolean
  true to return the DOM node instead of Ext.Element

Returns:

- `Element`
  The element

This method is defined by Element.

### clean

`public function clean([`Boolean forceReclean`])`
Removes worthless text nodes
Parameters:

- `forceReclean` : Boolean
  (optional) By default the element keeps track if it has been cleaned already so you can call this over and over. However, if you update the element and need to force a reclean, you can pass true.

Returns:

- `void`

This method is defined by Element.

### clearOpacity

`public function clearOpacity()`
Clears any opacity settings from this element. Required in some cases for IE.
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### clearPositioning

`public function clearPositioning([`String value`])`
Clear positioning back to the default when the document was loaded
Parameters:

- `value` : String
  (optional) The value to use for the left,right,top,bottom, defaults to '' (empty string). You could use 'auto'.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### clip

`public function clip()`
Store the current overflow setting and clip overflow on the element - use unclip to remove
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### contains

`public function contains(`HTMLElement/String el`)`
Returns true if this element is an ancestor of the passed element
Parameters:

- `el` : HTMLElement/String

Returns:

- `Boolean`

This method is defined by Element.

### createChild

`public function createChild(`Object config`, [`HTMLElement insertBefore`], [`Boolean returnDom`])`
Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
Parameters:

- `config` : Object
  DomHelper element config object
- `insertBefore` : HTMLElement
  (optional) a child element of this element
- `returnDom` : Boolean
  (optional) true to return the dom node instead of creating an Element

Returns:

- `Ext.Element`
  The new child element

This method is defined by Element.

### createProxy

`public function createProxy(`String/Object config`, [`String/HTMLElement renderTo`], [`Boolean matchBox`])`
Creates a proxy element of this element
Parameters:

- `config` : String/Object
  The class name of the proxy element or a DomHelper config object
- `renderTo` : String/HTMLElement
  (optional) The element or element id to render the proxy to (defaults to document.body)
- `matchBox` : Boolean
  (optional) True to align and size the proxy to this element now (defaults to false)

Returns:

- `Ext.Element`
  The new proxy element

This method is defined by Element.

### createShim

`public function createShim()`
Creates an iframe shim for this element to keep selects and other windowed objects from showing through.
Parameters:

- None.

Returns:

- `Ext.Element`
  The new shim element

This method is defined by Element.

### down

`public function down(`String selector`, `Boolean returnDom`)`
Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id)
Parameters:

- `selector` : String
  The CSS selector
- `returnDom` : Boolean
  true to return the DOM node instead of Ext.Element

Returns:

- `Element`
  The element

This method is defined by Element.

### enableDisplayMode

`public function enableDisplayMode([`String display`])`
Convenience method for setVisibilityMode(Element.DISPLAY)
Parameters:

- `display` : String
  (optional) What to set display to when visible

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### endMeasure

`public function endMeasure()`
Restores displays to before beginMeasure was called
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### findParent

`public function findParent(`String ss`, [`Number/String/HTMLElement/Element maxDepth`], [`Boolean returnEl`])`
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Parameters:

- `ss` : String
  The simple selector to test
- `maxDepth` : Number/String/HTMLElement/Element
  (optional) The max depth to search as a number or element (defaults to 10 || document.body)
- `returnEl` : Boolean
  (optional) True to return a Ext.Element object instead of DOM node

Returns:

- `HTMLElement`

This method is defined by Element.

### findParentNode

`public function findParentNode(`String ss`, [`Number/String/HTMLElement/Element maxDepth`], [`Boolean returnEl`])`
Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
Parameters:

- `ss` : String
  The simple selector to test
- `maxDepth` : Number/String/HTMLElement/Element
  (optional) The max depth to search as a number or element (defaults to 10 || document.body)
- `returnEl` : Boolean
  (optional) True to return a Ext.Element object instead of DOM node

Returns:

- `HTMLElement`

This method is defined by Element.

### fitToParent

`public function fitToParent([`Boolean monitorResize`], [`String/HTMLElment/Element targetParent`])`
Sizes this element to its parent element's dimensions performing neccessary box adjustments.
Parameters:

- `monitorResize` : Boolean
  (optional) If true maintains the fit when the browser window is resized.
- `targetParent` : String/HTMLElment/Element
  (optional) The target parent, default to the parentNode.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### focus

`public function focus()`
Tries to focus the element. Any exceptions are caught.
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### getAlignToXY

`public function getAlignToXY(`String/HTMLElement/Ext.Element element`, `String position`, [`Array offsets`])`
Gets the x,y coordinates to align this element with another element. See alignTo for more info on the supported position values.
Parameters:

- `element` : String/HTMLElement/Ext.Element
  The element to align to.
- `position` : String
  The position to align to.
- `offsets` : Array
  (optional) Offset the positioning by [x, y]

Returns:

- `Array`
  [x, y]

This method is defined by Element.

### getAnchorXY

`public function getAnchorXY([`String anchor`], [`Object size`], [`Boolean local`])`
Gets the x,y coordinates specified by the anchor position on the element.
Parameters:

- `anchor` : String
  (optional) The specified anchor position (defaults to "c"). See alignTo for details on supported anchor positions.
- `size` : Object
  (optional) An object containing the size to use for calculating anchor position {width: (target width), height: (target height)} (defaults to the element's current size)
- `local` : Boolean
  (optional) True to get the local (element top/left-relative) anchor position instead of page coordinates

Returns:

- `Array`
  [x, y] An array containing the element's x and y coordinates

This method is defined by Element.

### getBorderWidth

`public function getBorderWidth(`String side`)`
Gets the width of the border(s) for the specified side(s)
Parameters:

- `side` : String
  Can be t, l, r, b or any combination of those to add multiple values. For example, passing lr would get the border (l)eft width + the border (r)ight width.

Returns:

- `Number`
  The width of the sides passed added together

This method is defined by Element.

### getBottom

`public function getBottom(`Boolean local`)`
Gets the bottom Y coordinate of the element (element Y position + element height)
Parameters:

- `local` : Boolean
  True to get the local css position instead of page coordinate

Returns:

- `Number`

This method is defined by Element.

### getBox

`public function getBox([`Boolean contentBox`], [`Boolean local`])`
Return a box {x, y, width, height} that can be used to set another elements size/location to match this element.
Parameters:

- `contentBox` : Boolean
  (optional) If true a box for the content of the element is returned.
- `local` : Boolean
  (optional) If true the element's left and top are returned instead of page x/y.

Returns:

- `Object`

This method is defined by Element.

### getCenterXY

`public function getCenterXY()`
Calculates the x, y to center this element on the screen
Parameters:

- None.

Returns:

- `Array`
  The x, y values [x, y]

This method is defined by Element.

### getColor

`public function getColor(`String attr`, `String defaultValue`, [`String prefix`])`
Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values are convert to standard 6 digit hex color.
Parameters:

- `attr` : String
  The css attribute
- `defaultValue` : String
  The default value to use when a valid color isn't found
- `prefix` : String
  (optional) defaults to #. Use an empty string when working with YUI color anims.

Returns:

- `void`

This method is defined by Element.

### getComputedHeight

`public function getComputedHeight()`
Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements if a height has not been set using CSS.
Parameters:

- None.

Returns:

- `Number`

This method is defined by Element.

### getComputedWidth

`public function getComputedWidth()`
Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements if a width has not been set using CSS.
Parameters:

- None.

Returns:

- `Number`

This method is defined by Element.

### getFrameWidth

`public function getFrameWidth(`String sides`)`
Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth() for more information about the sides.
Parameters:

- `sides` : String

Returns:

- `Number`

This method is defined by Element.

### getHeight

`public function getHeight([`Boolean contentHeight`])`
Returns the offset height of the element
Parameters:

- `contentHeight` : Boolean
  (optional) true to get the height minus borders and padding

Returns:

- `Number`
  The element's height

This method is defined by Element.

### getLeft

`public function getLeft(`Boolean local`)`
Gets the left X coordinate
Parameters:

- `local` : Boolean
  True to get the local css position instead of page coordinate

Returns:

- `Number`

This method is defined by Element.

### getMargins

`public function getMargins([`String sides`])`
Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed, then it returns the calculated width of the sides (see getPadding)
Parameters:

- `sides` : String
  (optional) Any combination of l, r, t, b to get the sum of those sides

Returns:

- `Object/Number`

This method is defined by Element.

### getNextSibling

`public function getNextSibling()`
Gets the next sibling, skipping text nodes
Parameters:

- None.

Returns:

- `HTMLElement`
  The next sibling or null

This method is defined by Element.

### getPadding

`public function getPadding(`String side`)`
Gets the width of the padding(s) for the specified side(s)
Parameters:

- `side` : String
  Can be t, l, r, b or any combination of those to add multiple values. For example, passing lr would get the padding (l)eft + the padding (r)ight.

Returns:

- `Number`
  The padding of the sides passed added together

This method is defined by Element.

### getPositioning

`public function getPositioning()`
Gets an object with all CSS positioning properties. Useful along with setPostioning to get snapshot before performing an update and then restoring the element.
Parameters:

- None.

Returns:

- `Object`

This method is defined by Element.

### getPrevSibling

`public function getPrevSibling()`
Gets the previous sibling, skipping text nodes
Parameters:

- None.

Returns:

- `HTMLElement`
  The previous sibling or null

This method is defined by Element.

### getRegion

`public function getRegion()`
Returns the region of the given element. The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
Parameters:

- None.

Returns:

- `Region`
  A Ext.lib.Region containing "top, left, bottom, right" member data.

This method is defined by Element.

### getRight

`public function getRight(`Boolean local`)`
Gets the right X coordinate of the element (element X position + element width)
Parameters:

- `local` : Boolean
  True to get the local css position instead of page coordinate

Returns:

- `Number`

This method is defined by Element.

### getSize

`public function getSize([`Boolean contentSize`])`
Returns the size of the element
Parameters:

- `contentSize` : Boolean
  (optional) true to get the width/size minus borders and padding

Returns:

- `Object`
  An object containing the element's size {width: (element width), height: (element height)}

This method is defined by Element.

### getStyle

`public function getStyle(`String property`)`
Normalizes currentStyle and computedStyle. This is not YUI getStyle, it is an optimised version.
Parameters:

- `property` : String
  The style property whose value is returned.

Returns:

- `String`
  The current value of the style property for this element.

This method is defined by Element.

### getStyles

`public function getStyles(`String style1`, `String style2`, `String etc`)`
Get an object with properties matching the styles requested. e.g. el.getStyles('color', 'font-size', 'width') might return {'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.
Parameters:

- `style1` : String
- `style2` : String
- `etc` : String

Returns:

- `Object`

This method is defined by Element.

### getTop

`public function getTop(`Boolean local`)`
Gets the top Y coordinate
Parameters:

- `local` : Boolean
  True to get the local css position instead of page coordinate

Returns:

- `Number`

This method is defined by Element.

### getUpdateManager

`public function getUpdateManager()`
Gets this elements UpdateManager
Parameters:

- None.

Returns:

- `Ext.UpdateManager`
  The UpdateManager

This method is defined by Element.

### getValue

`public function getValue(`Boolean asNumber`)`
Returns the value of the "value" attribute
Parameters:

- `asNumber` : Boolean
  true to parse the value as a number

Returns:

- `String/Number`

This method is defined by Element.

### getWidth

`public function getWidth([`Boolean contentWidth`])`
Returns the offset width of the element
Parameters:

- `contentWidth` : Boolean
  (optional) true to get the width minus borders and padding

Returns:

- `Number`
  The element's width

This method is defined by Element.

### getX

`public function getX()`
Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- None.

Returns:

- `Number`
  The X position of the element

This method is defined by Element.

### getXY

`public function getXY()`
Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- None.

Returns:

- `Array`
  The XY position of the element

This method is defined by Element.

### getY

`public function getY()`
Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- None.

Returns:

- `Number`
  The Y position of the element

This method is defined by Element.

### hasClass

`public function hasClass(`String className`)`
Checks if a CSS class is in use by the element.
Parameters:

- `className` : String
  The CSS class to check

Returns:

- `Boolean`
  true or false

This method is defined by Element.

### hide

`public function hide([`Boolean/Object animate`])`
Hide this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Parameters:

- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### initDD

`public function initDD(`String group`, `Object config`, `Object overrides`)`
Initializes a Ext.dd.DD object for this element.
Parameters:

- `group` : String
  The group the DD object is member of
- `config` : Object
  The DD config object
- `overrides` : Object
  An object containing methods to override/implement on the DD object

Returns:

- `Ext.dd.DD`
  The DD object

This method is defined by Element.

### initDDProxy

`public function initDDProxy(`String group`, `Object config`, `Object overrides`)`
Initializes a Ext.dd.DDProxy object for this element.
Parameters:

- `group` : String
  The group the DDProxy object is member of
- `config` : Object
  The DDProxy config object
- `overrides` : Object
  An object containing methods to override/implement on the DDProxy object

Returns:

- `Ext.dd.DDProxy`
  The DDProxy object

This method is defined by Element.

### initDDTarget

`public function initDDTarget(`String group`, `Object config`, `Object overrides`)`
Initializes a Ext.dd.DDTarget object for this element.
Parameters:

- `group` : String
  The group the DDTarget object is member of
- `config` : Object
  The DDTarget config object
- `overrides` : Object
  An object containing methods to override/implement on the DDTarget object

Returns:

- `Ext.dd.DDTarget`
  The DDTarget object

This method is defined by Element.

### insertAfter

`public function insertAfter(`String/HTMLElement/Element el`)`
Inserts this element after the passed element in the DOM
Parameters:

- `el` : String/HTMLElement/Element
  The element to insert after

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### insertBefore

`public function insertBefore(`String/HTMLElement/Element el`)`
Inserts this element before the passed element in the DOM
Parameters:

- `el` : String/HTMLElement/Element
  The element to insert before

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### insertFirst

`public function insertFirst(`String/HTMLElement/Element/Object el`)`
Inserts (or creates) an element (or DomHelper config) as the first child of the this element
Parameters:

- `el` : String/HTMLElement/Element/Object
  The id or element to insert or a DomHelper config to create and insert

Returns:

- `Ext.Element`
  The new child

This method is defined by Element.

### insertHtml

`public function insertHtml(`String where`, `String html`)`
Inserts an html fragment into this element
Parameters:

- `where` : String
  Where to insert the html in relation to the this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
- `html` : String
  The HTML fragment

Returns:

- `HTMLElement`
  The inserted node (or nearest related if more than 1 inserted)

This method is defined by Element.

### insertSibling

`public function insertSibling(`String/HTMLElement/Element/Object el`, [`String where`], [`Boolean returnDom`])`
Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
Parameters:

- `el` : String/HTMLElement/Element/Object
  The id or element to insert or a DomHelper config to create and insert
- `where` : String
  (optional) 'before' or 'after' defaults to before
- `returnDom` : Boolean
  (optional) True to return the raw DOM element instead of Ext.Element

Returns:

- `Ext.Element`
  the inserted Element

This method is defined by Element.

### is

`public function is(`String ss`)`
Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
Parameters:

- `ss` : String
  The simple selector to test

Returns:

- `Boolean`

This method is defined by Element.

### isBorderBox

`public function isBorderBox()`
Tests various css rules/browsers to determine if this element uses a border box
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by Element.

### isDisplayed

`public function isDisplayed()`
Returns true if display is not "none"
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by Element.

### isMasked

`public function isMasked()`
Returns true if this element is masked
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by Element.

### isScrollable

`public function isScrollable()`
Returns true if this element is scrollable.
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by Element.

### isVisible

`public function isVisible(`Boolean deep`)`
Checks whether the element is currently visible using both visibility and display properties.
Parameters:

- `deep` : Boolean
  True to walk the dom and see if parent elements are hidden.

Returns:

- `Boolean`
  true if the element is currently visible

This method is defined by Element.

### load

`public function load(`String/Function url`, [`String/Object params`], [`Function callback`], [`Boolean discardUrl`])`
Direct access to the UpdateManager update() method (takes the same parameters).
Parameters:

- `url` : String/Function
  The url for this request or a function to call to get the url
- `params` : String/Object
  (optional) The parameters to pass as either a url encoded string "param1=1&param2=2" or an object {param1: 1, param2: 2}
- `callback` : Function
  (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- `discardUrl` : Boolean
  (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### mask

`public function mask([`String msg`], [`String msgCls`])`
Puts a mask over this element to disable user interaction. Requires core.css. This method can only be applied to elements which accept child nodes.
Parameters:

- `msg` : String
  (optional) A message to display in the mask
- `msgCls` : String
  (optional) A css class to apply to the msg element

Returns:

- `Element`
  The message element

This method is defined by Element.

### move

`public function move(`String direction`, `Number distance`, [`Boolean/Object animate`])`
Move this element relative to its current position.
Parameters:

- `direction` : String
  Possible values are: "l","left" - "r","right" - "t","top","up" - "b","bottom","down".
- `distance` : Number
  How far to move the element in pixels
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### moveTo

`public function moveTo(`Number x`, `Number y`, [`Boolean/Object animate`])`
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- `x` : Number
  X value for new position (coordinates are page-based)
- `y` : Number
  Y value for new position (coordinates are page-based)
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### position

`public function position([`String pos`], [`Number zIndex`], [`Number x`], [`Number y`])`
Initializes positioning on this element. If a desired position is not passed, it will make the the element positioned relative IF it is not already positioned.
Parameters:

- `pos` : String
  (optional) Positioning to use "relative", "absolute" or "fixed"
- `zIndex` : Number
  (optional) The zIndex to apply
- `x` : Number
  (optional) Set the page X position
- `y` : Number
  (optional) Set the page Y position

Returns:

- `void`

This method is defined by Element.

### query

`public function query(`String selector`)`
Selects child nodes based on the passed CSS selector (the selector should not contain an id)
Parameters:

- `selector` : String
  The CSS selector

Returns:

- `Array`
  An array of the matched nodes

This method is defined by Element.

### radioClass

`public function radioClass(`String className`)`
Adds the passed className to this element and removes the class from all siblings
Parameters:

- `className` : String
  The className to add

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### remove

`public function remove()`
Removes this element from the DOM and deletes it from the cache
Parameters:

- None.

Returns:

- `void`

This method is defined by Element.

### removeAllListeners

`public function removeAllListeners()`
Removes all previous added listeners from this element
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### removeClass

`public function removeClass(`String/Array className`)`
Removes a CSS class from the element.
Parameters:

- `className` : String/Array
  The CSS class to remove or an array of classes

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### removeListener

`public function removeListener(`String eventName`, `Function fn`)`
Removes an event handler from this element
Parameters:

- `eventName` : String
  the type of event to remove
- `fn` : Function
  the method the event invokes

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### repaint

`public function repaint()`
Forces the browser to repaint this element
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### replace

`public function replace(`String/HTMLElement/Element el`)`
Replaces the passed element with this element
Parameters:

- `el` : String/HTMLElement/Element
  The element to replace

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### replaceClass

`public function replaceClass(`String oldClassName`, `String newClassName`)`
Replaces a CSS class on the element with another.
Parameters:

- `oldClassName` : String
  The CSS class to replace
- `newClassName` : String
  The replacement CSS class

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### scroll

`public function scroll(`String direction`, `Number distance`, [`Boolean/Object animate`])`
Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this elements scrollable range.
Parameters:

- `direction` : String
  Possible values are: "l","left" - "r","right" - "t","top","up" - "b","bottom","down".
- `distance` : Number
  How far to scroll the element in pixels
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Boolean`
  Returns true if a scroll was triggered or false if the element was scrolled as far as it could go.

This method is defined by Element.

### scrollIntoView

`public function scrollIntoView([`String/HTMLElement/Element container`], [`Boolean hscroll`])`
Scrolls this element into view within the passed container.
Parameters:

- `container` : String/HTMLElement/Element
  (optional) The container element to scroll (defaults to document.body)
- `hscroll` : Boolean
  (optional) false to disable horizontal scroll

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### scrollTo

`public function scrollTo(`String side`, `Number value`, [`Boolean/Object animate`])`
Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
Parameters:

- `side` : String
  Either "left" for scrollLeft values or "top" for scrollTop values.
- `value` : Number
  The new scroll value
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Element`
  this

This method is defined by Element.

### select

`public function select(`String selector`, `Boolean unique`)`
Creates a CompositeElement for child nodes based on the passed CSS selector (the selector should not contain an id)
Parameters:

- `selector` : String
  The CSS selector
- `unique` : Boolean
  true to create a unique Ext.Element for each child (defaults to a shared flyweight object)

Returns:

- `CompositeElement/CompositeElementLite`
  The composite element

This method is defined by Element.

### set

`public function set(`Object o`, [`Boolean useSet`])`
Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
Parameters:

- `o` : Object
  The object with the attributes
- `useSet` : Boolean
  (optional) false to override the default setAttribute to use expandos.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setBottom

`public function setBottom(`String bottom`)`
Set the element's css bottom style
Parameters:

- `bottom` : String
  The bottom CSS property value

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setBounds

`public function setBounds(`Number x`, `Number y`, `Number width`, `Number height`, [`Boolean/Object animate`])`
Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
Parameters:

- `x` : Number
  X value for new position (coordinates are page-based)
- `y` : Number
  Y value for new position (coordinates are page-based)
- `width` : Number
  The new width
- `height` : Number
  The new height
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setBox

`public function setBox(`Object box`, [`Boolean adjust`], [`Boolean/Object animate`])`
Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
Parameters:

- `box` : Object
  The box to fill {x, y, width, height}
- `adjust` : Boolean
  (optional) Whether to adjust for box-model issues automatically
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setDisplayed

`public function setDisplayed(`Boolean value`)`
Sets the css display. Uses originalDisplay if value is a boolean true.
Parameters:

- `value` : Boolean
  Boolean to display the element using its default display or a string to set the display directly

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setHeight

`public function setHeight(`Number height`, [`Boolean/Object animate`])`
Set the height of the element
Parameters:

- `height` : Number
  The new height
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setLeft

`public function setLeft(`String left`)`
Set the element's left position directly using CSS style (instead of setX())
Parameters:

- `left` : String
  The left CSS property value

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setLeftTop

`public function setLeftTop()`
Quick set left and top adding default units
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setLocation

`public function setLocation(`Number x`, `Number y`, [`Boolean/Object animate`])`
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- `x` : Number
  X value for new position (coordinates are page-based)
- `y` : Number
  Y value for new position (coordinates are page-based)
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setOpacity

`public function setOpacity(`Float opacity`, [`Boolean/Object animate`])`
Set the opacity of the element
Parameters:

- `opacity` : Float
  The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setPositioning

`public function setPositioning(`Object posCfg`)`
Set positioning with an object returned by getPositioning().
Parameters:

- `posCfg` : Object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setRegion

`public function setRegion(`Ext.lib.Region region`, [`Boolean/Object animate`])`
Sets the element's position and size the the specified region. If animation is true then width, height, x and y will be animated concurrently.
Parameters:

- `region` : Ext.lib.Region
  The region to fill
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setRight

`public function setRight(`String right`)`
Set the element's css right style
Parameters:

- `right` : String
  The right CSS property value

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setSize

`public function setSize(`Number width`, `Number height`, [`Boolean/Object animate`])`
Set the size of the element. If animation is true, both width an height will be animated concurrently.
Parameters:

- `width` : Number
  The new width
- `height` : Number
  The new height
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setStyle

`public function setStyle(`String/Object property`, [`String val`])`
Wrapper for setting style properties, also takes single object parameter of multiple styles
Parameters:

- `property` : String/Object
  The style property to be set or an object of multiple styles.
- `val` : String
  (optional) The value to apply to the given property or null if an object was passed.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setTop

`public function setTop(`String top`)`
Set the element's top position directly using CSS style (instead of setY())
Parameters:

- `top` : String
  The top CSS property value

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setVisibilityMode

`public function setVisibilityMode(`visMode Element.VISIBILITY`)`
Sets the elements visibility mode. When setVisible() is called it will use this to determine whether to set the visibility or the display property.
Parameters:

- `Element.VISIBILITY` : visMode
  or Element.DISPLAY

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setVisible

`public function setVisible(`Boolean visible`, [`Boolean/Object animate`])`
Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
Parameters:

- `visible` : Boolean
  Whether the element is visible
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setWidth

`public function setWidth(`Number width`, [`Boolean/Object animate`])`
Set the width of the element
Parameters:

- `width` : Number
  The new width
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setX

`public function setX(`Number The`, [`Boolean/Object animate`])`
Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- `The` : Number
  X position of the element
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setXY

`public function setXY(`Array pos`, [`Boolean/Object animate`])`
Set the position of the element in page coordinates, regardless of how the element is positioned. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- `pos` : Array
  Contains X & Y [x, y] values for new position (coordinates are page-based)
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### setY

`public function setY(`Number The`, [`Boolean/Object animate`])`
Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Parameters:

- `The` : Number
  Y position of the element
- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### show

`public function show([`Boolean/Object animate`])`
Show this element - Uses display mode to determine whether to use "display" or "visibility". See setVisible.
Parameters:

- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### swallowEvent

`public function swallowEvent(`String eventName`, [`Boolean preventDefault`])`
Stops the specified event from bubbling and optionally prevents the default action
Parameters:

- `eventName` : String
- `preventDefault` : Boolean
  (optional) true to prevent the default action too

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### toggle

`public function toggle([`Boolean/Object animate`])`
Toggles the elements visibility or display, depending on visibility mode.
Parameters:

- `animate` : Boolean/Object
  (optional) true for the default animation or a standard Element animation config object

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### toggleClass

`public function toggleClass(`String className`)`
Toggles (adds or removes) the passed class.
Parameters:

- `className` : String

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### translatePoints

`public function translatePoints(`Number/Array x`, `Number y`, `Object An`)`
Translates the passed page coordinates into left/top css values for this element
Parameters:

- `x` : Number/Array
  The page x or an array containing [x, y]
- `y` : Number
  The page y
- `An` : Object
  object with left and top properties. e.g. {left: (value), top: (value)}

Returns:

- `void`

This method is defined by Element.

### unclip

`public function unclip()`
Return clipping (overflow) to original clipping before clip() was called
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### unmask

`public function unmask()`
Removes a previously applied mask. If removeEl is true the mask overlay is destroyed, otherwise it is cached for reuse.
Parameters:

- None.

Returns:

- `void`

This method is defined by Element.

### unselectable

`public function unselectable()`
Disables text selection for this element (normalized across browsers)
Parameters:

- None.

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### up

`public function up(`String ss`, [`Number/String/HTMLElement/Element maxDepth`])`
Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child). This is a shortcut for findParentNode() that always returns an Ext.Element.
Parameters:

- `ss` : String
  The simple selector to test
- `maxDepth` : Number/String/HTMLElement/Element
  (optional) The max depth to search as a number or element (defaults to 10 || document.body)

Returns:

- `Ext.Element`

This method is defined by Element.

### update

`public function update(`String html`, [`Boolean loadScripts`], `Function callback`)`
Update the innerHTML of this element, optionally searching for and processing scripts
Parameters:

- `html` : String
  The new HTML
- `loadScripts` : Boolean
  (optional) true to look for and process scripts
- `callback` : Function
  For async script loading you can be noticed when the update completes

Returns:

- `Ext.Element`
  this

This method is defined by Element.

### wrap

`public function wrap([`Object config`], [`Boolean returnDom`])`
Creates and wraps this element with another element
Parameters:

- `config` : Object
  (optional) DomHelper element config object for the wrapper element or null for an empty div
- `returnDom` : Boolean
  (optional) True to return the raw DOM element instead of Ext.Element

Returns:

- `/HTMLElementElement`
  The newly created wrapper element

This method is defined by Element.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.