# Yahoo! UI Library

### dom 2.8.0r4

Yahoo! UI Library > dom > YAHOO.util.Region
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.util.Region

Known Subclasses:
  YAHOO.util.Point

A region is a representation of an object on a grid. It is defined by the top, right, bottom, left extents, so is rectangular by default. If other shapes are required, this class could be extended to support it.

### Constructor

YAHOO.util.Region `( t , r , b , l )`

Parameters:
  `t <Int>` the top extent
  `r <Int>` the right extent
  `b <Int>` the bottom extent
  `l <Int>` the left extent

### Properties

#### 0 - `Int`

The region's left extent as index, for symmetry with set/getXY

#### 1 - `Int`

The region's top extent as index, for symmetry with set/getXY

#### bottom - `Int`

The region's bottom extent

#### height - `Int`

The region's total height

#### left - `Int`

The region's left extent

#### right - `int`

The region's right extent

#### top - `Int`

The region's top extent

#### width - `Int`

The region's total width

#### x - `Int`

The region's left extent

#### y - `Int`

The region's top extent

### Methods

#### contains

`Boolean contains ( region )`
Returns true if this region contains the region passed in

Parameters:
  `region <Region>` The region to evaluate

Returns: `Boolean`
  True if the region is contained with this region, else false

#### getArea

`Int getArea ( )`
Returns the area of the region

Returns: `Int`
  the region's area

#### getRegion

`static Region getRegion ( el )`
Returns a region that is occupied by the DOM element

Parameters:
  `el <HTMLElement>` The element

Returns: `Region`
  The region that the element occupies

#### intersect

`Region intersect ( region )`
Returns the region where the passed in region overlaps with this one

Parameters:
  `region <Region>` The region that intersects

Returns: `Region`
  The overlap region, or null if there is no overlap

#### toString

`toString ( )`
toString

#### union

`Region union ( region )`
Returns the region representing the smallest region that can contain both the passed in region and this region.

Parameters:
  `region <Region>` The region that to create the union with

Returns: `Region`
  The union region

Copyright © 2009 Yahoo! Inc. All rights reserved.