Print Friendly

# Class YAHOO.ext.util.Config

Package: | YAHOO.ext.util
Class: | Config
Extends: | Object
Defined In: | yutil.js

Class with one useful method
This class is a singleton and cannot be created directly.

## Public Properties

Property | Defined By
--- | ---
| left : Object | Config
Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).

## Public Methods

Method | Defined By
--- | ---
| apply(`Object obj`, `Object config`, `Object defaults`) : Object | Config
Copies all the properties of config to obj.
| constrainTo(`String/HTMLElement/Element constrainTo`, [`Object/Number pad`], [`Boolean inContent`]) : void | Config
Initializes the drag drop object's constraints to restrict movement to a certain element.

## Public Events

This class has no public events.

## Property Details

### left

`public Object left`
Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).
This property is defined by Config.

## Method Details

### apply

`public function apply(`Object obj`, `Object config`, `Object defaults`)`
Copies all the properties of config to obj.
Parameters:

- `obj` : Object
  The receiver of the properties
- `config` : Object
  The source of the properties
- `defaults` : Object
  A different object that will also be applied for default values

Returns:

- `Object`
  returns obj

This method is defined by Config.

### constrainTo

`public function constrainTo(`String/HTMLElement/Element constrainTo`, [`Object/Number pad`], [`Boolean inContent`])`
Initializes the drag drop object's constraints to restrict movement to a certain element.
Parameters:

- `constrainTo` : String/HTMLElement/Element
  The element to constrain to.
- `pad` : Object/Number
  (optional) Pad provides a way to specify "padding" of the constraints, and can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or an object containing the sides to pad. For example: {right:10, bottom:10}
- `inContent` : Boolean
  (optional) Constrain the draggable in the content box of the element (inside padding and borders)

Returns:

- `void`

This method is defined by Config.

Copyright © 2006 Jack Slocum. All rights reserved.