Class YAHOO.ext.Element

Object
   |
   +--YAHOO.ext.Element
Direct Known Subclasses:
YAHOO.ext.Actor, YAHOO.ext.Animator

class YAHOO.ext.Element


Wraps around a DOM element and provides convenient access to Yahoo UI library functionality.

Usage:


 var el = YAHOO.ext.Element.get('myElementId');
 // or the shorter
 var el = getEl('myElementId');
 
Using YAHOO.ext.Element.get() instead of calling the constructor directly ensures you get the same object each call instead of constructing a new one.

Defined in Element.js

Requires:


Field Summary
 Object autoBoxAdjust
  Whether to automatically adjust width and height settings for box-model issues
 String defaultUnit
  The default unit to append to CSS values where a unit isn't provided (Defaults to px).
 String id
  The DOM element ID
 CustomEvent onMoved
  Fires when element moves.
 CustomEvent onResized
  Fires when element is resized.
 CustomEvent onVisibilityChanged
  Fires when visibility changes.
<static>  Number DISPLAY
  Visibility mode constant - Use display to hide element
<static>  Number VISIBILITY
  Visibility mode constant - Use visibility to hide element
 
Constructor Summary
YAHOO.ext.Element (<String> elementId, <Boolean> forceNew)
  
 
Method Summary * Parameter types in italic indicate optional parameters
 void addClass(<String> className)
   Add a CSS class to the element.
 void addHandler(<String> eventName, <Boolean> stopPropagation, <Function> handler, <Object> scope, <boolean> override)
   Appends an event handler to this element and automatically prevents the default action, and if set stops propagation (bubbling) as well
 void addListener(<String> eventName, <Function> handler, <Object> scope, <boolean> override)
   Appends an event handler to this element
 Object addManagedListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
   Append a managed listener - See YAHOO.ext.EventObject for more details.
 void alignTo(<String/HTMLElement/YAHOO.ext.Element> element, <String> position, <Array> offsets, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Align this element with another element.
 void animate(<Object> args, <Float> duration, <Function> onComplete, <Function> easing, <Function> animType)
   Perform Yahoo UI animation on this element.
 void beginMeasure()
  
 void clearOpacity()
   Clears any opacity settings from this element.
 void clearPositioning()
   Clear positioning back to the default when the document was loaded
 void clip()
   Clip overflow on the element - use unclip() to remove
 void enableDisplayMode()
   Convenience method for setVisibilityMode(Element.DISPLAY)
 void endMeasure()
  
 void focus()
   Tries to focus the element.
 Number getBorderWidth(<String> side)
   Gets the width of the border(s) for the specified side(s)
 String getBottom()
   Gets the bottom Y coordinate of the element (element Y position + element height)
 void getBox(contentBox)
   Return a box {x, y, width, height} that can be used to set another elements size to match this element.
 Array getCenterXY(offsetScroll)
   Calculates the x, y to center this element on the screen
 Array getChildrenByClassName(<String> className, <String> tagName)
   Gets an array of child YAHOO.ext.Element objects by class name and optional tagName
 Array getChildrenByTagName(<String> tagName)
   Gets an array of child YAHOO.ext.Element objects by tag name
 Number getHeight()
   Returns the offset height of the element
 Object getLeft()
   Same as getX()
 Number getPadding(<String> side)
   Gets the width of the padding(s) for the specified side(s)
 void getPositioning()
   Gets an object with all CSS positioning properties.
 Region getRegion()
   Returns the region position of the given element.
 String getRight()
   Gets the right X coordinate of the element (element X position + element width)
 Object} getSize()
   Returns the size of the element
 String getStyle(name)
   Normalizes currentStyle and ComputedStyle.
 Object getTop()
   Same as getY()
 YAHOO.ext.UpdateManager getUpdateManager()
   Gets this elements UpdateManager
 Number getWidth()
   Returns the offset width of the element
 Object getX()
   Gets the current X position of the element based on page coordinates.
 Object getXY()
   Gets the current position of the element based on page coordinates.
 Object getY()
   Gets the current Y position of the element based on page coordinates.
 Boolean hasClass(<String> className)
   Checks if a CSS class is in use by the element.
 void hide(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Hide this element - Uses display mode to determine whether to use "display" or "visibility".
 void isBorderBox()
   Tests various css rules/browsers to determine if this element uses a border box
 Boolean isVisible(<Boolean> deep)
   Checks whether the element is currently visible using both visibility and display properties.
 Object mon(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
   Append a managed listener (shorthanded for addManagedListener())
 void move(<String> direction, <Number> distance, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Move this element relative to it's current position.
 void moveTo(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the position of the element in page coordinates, regardless of how the element is positioned.
 void on(<String> eventName, <Function> handler, <Object> scope, <boolean> override)
   Appends an event handler to this element (Same as addListener)
 void radioClass(className)
   Adds the passed className to this element and removes the class from all siblings
 void removeAllListeners()
   Removes all previous added listeners from this element
 void removeClass(<String> className)
   Removes a CSS class from the element.
 void removeListener(eventName, handler)
   Removes an event handler from this element
 void replaceClass(<String> oldClassName, <String> newClassName)
   Replaces a CSS class on the element with another.
 void setAbsolutePositioned(<Number> zIndex)
   Set the element as absolute positioned with the specified z-index
 void setBottom(bottom)
   Set the element's css bottom style
 void setBounds(<Number> x, <Number> y, <Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Sets the element's position and size in one shot.
 void setBox(<Object> box, <Boolean> adjust, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Sets the element's box.
 void setHeight(<Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the height of the element
 void setLeft(<String> left)
   Set the element's X position directly using CSS style (instead of setX())
 void setLocation(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the position of the element in page coordinates, regardless of how the element is positioned.
 void setOpacity(<Float> opacity, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Set the opacity of the element
 void setPositioning(positionCfg)
   Set positioning with an object returned by getPositioning().
 void setRegion(<YAHOO.util.Region> region, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Sets the element's position and size the the specified region.
 void setRelativePositioned(<Number> zIndex)
   Set the element as relative positioned with the specified z-index
 void setRight(right)
   Set the element's css right style
 void setSize(<Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the size of the element.
 void setStyle(name, value)
   Wrapper for setting style properties
 void setTop(<String> top)
   Set the element's Y position directly using CSS style (instead of setY())
 void setVisibilityMode(visMode)
   Sets the elements visibility mode.
 void setVisible(<Boolean> visible, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Sets the visibility of the element (see details).
 void setWidth(<Number> width, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the width of the element
 void setX(x)
   Sets the X position of the element based on page coordinates.
 void setXY(<Array> pos, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Set the position of the element in page coordinates, regardless of how the element is positioned.
 void setY(y)
   Sets the Y position of the element based on page coordinates.
 void show(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
   Show this element - Uses display mode to determine whether to use "display" or "visibility".
 void toggle(<Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
   Toggles the elements visibility or display, depending on visibility mode.
 void toggleClass(className)
  
 void unclip()
   Return clipping (overflow) to original clipping when the document loaded
 void update(<String> html, <Boolean> loadScripts)
   Update the innerHTML of this element, optionally searching for and processing scripts
<static> Element get(<String/HTMLElement/Element> el, <Boolean> autoGenerateId)
   Static method to retreive Element objects.

Field Detail

autoBoxAdjust

Object autoBoxAdjust

defaultUnit

String defaultUnit

id

String id

onMoved

CustomEvent onMoved

onResized

CustomEvent onResized

onVisibilityChanged

CustomEvent onVisibilityChanged

DISPLAY

<static> Number DISPLAY

VISIBILITY

<static> Number VISIBILITY

Constructor Detail

YAHOO.ext.Element

YAHOO.ext.Element(<String> elementId, <Boolean> forceNew)

Method Detail

addClass

void addClass(<String> className)

addHandler

void addHandler(<String> eventName, <Boolean> stopPropagation, <Function> handler, <Object> scope, <boolean> override)

addListener

void addListener(<String> eventName, <Function> handler, <Object> scope, <boolean> override)

addManagedListener

Object addManagedListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)

alignTo

void alignTo(<String/HTMLElement/YAHOO.ext.Element> element, <String> position, <Array> offsets, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

animate

void animate(<Object> args, <Float> duration, <Function> onComplete, <Function> easing, <Function> animType)

beginMeasure

void beginMeasure()

clearOpacity

void clearOpacity()

clearPositioning

void clearPositioning()

clip

void clip()

enableDisplayMode

void enableDisplayMode()

endMeasure

void endMeasure()

focus

void focus()

getBorderWidth

Number getBorderWidth(<String> side)

getBottom

String getBottom()

getBox

void getBox(contentBox)

getCenterXY

Array getCenterXY(offsetScroll)

getChildrenByClassName

Array getChildrenByClassName(<String> className, <String> tagName)

getChildrenByTagName

Array getChildrenByTagName(<String> tagName)

getHeight

Number getHeight()

getLeft

Object getLeft()

getPadding

Number getPadding(<String> side)

getPositioning

void getPositioning()

getRegion

Region getRegion()

getRight

String getRight()

getSize

Object} getSize()

getStyle

String getStyle(name)

getTop

Object getTop()

getUpdateManager

YAHOO.ext.UpdateManager getUpdateManager()

getWidth

Number getWidth()

getX

Object getX()

getXY

Object getXY()

getY

Object getY()

hasClass

Boolean hasClass(<String> className)

hide

void hide(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

isBorderBox

void isBorderBox()

isVisible

Boolean isVisible(<Boolean> deep)

mon

Object mon(<String> eventName, <Function> fn, <Object> scope, <boolean> override)

move

void move(<String> direction, <Number> distance, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

moveTo

void moveTo(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

on

void on(<String> eventName, <Function> handler, <Object> scope, <boolean> override)

radioClass

void radioClass(className)

removeAllListeners

void removeAllListeners()

removeClass

void removeClass(<String> className)

removeListener

void removeListener(eventName, handler)

replaceClass

void replaceClass(<String> oldClassName, <String> newClassName)

setAbsolutePositioned

void setAbsolutePositioned(<Number> zIndex)

setBottom

void setBottom(bottom)

setBounds

void setBounds(<Number> x, <Number> y, <Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setBox

void setBox(<Object> box, <Boolean> adjust, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setHeight

void setHeight(<Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setLeft

void setLeft(<String> left)

setLocation

void setLocation(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setOpacity

void setOpacity(<Float> opacity, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

setPositioning

void setPositioning(positionCfg)

setRegion

void setRegion(<YAHOO.util.Region> region, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setRelativePositioned

void setRelativePositioned(<Number> zIndex)

setRight

void setRight(right)

setSize

void setSize(<Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setStyle

void setStyle(name, value)

setTop

void setTop(<String> top)

setVisibilityMode

void setVisibilityMode(visMode)

setVisible

void setVisible(<Boolean> visible, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

setWidth

void setWidth(<Number> width, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setX

void setX(x)

setXY

void setXY(<Array> pos, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

setY

void setY(y)

show

void show(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)

toggle

void toggle(<Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)

toggleClass

void toggleClass(className)

unclip

void unclip()

update

void update(<String> html, <Boolean> loadScripts)

get

<static> Element get(<String/HTMLElement/Element> el, <Boolean> autoGenerateId)


Documentation generated by JSDoc on Sat Oct 14 06:07:10 2006