The YUI global namespace object. If YUI is already defined, the
existing YUI object will not be overwritten so that defined
namespaces are preserved. It is the constructor for the object
the end user interacts with. As indicated below, each instance
has full custom event support, but only if the event system
is available.
Constructor
YUI
(
o*
)
- Parameters:
-
o*
<object>
0..n optional configuration objects. these values
are store in Y.config. See config for the list of supported
properties.
Properties
_evtGuid
- protected { String }
Detach category for internal events to aid in cleanup.
_factor
- protected { Number }
Factor used to translate value -> position -> value.
_key
- protected { Object }
Map to property names based on axis
for use in
calculation and accessing event info.
_offsetXY
- protected { Number }
Cached X or Y offset for the constraining element to avoid extraneous
getXY()
calls during run time calculation.
ATTRS
- protected static {Object}
Object property names used for respective X and Y axis accessors (e.g.
"width" vs. "height" for referencing the
constraining element's appropriate dimension.)
DDValue.NAME
- protected static {String}
Default Value: "ddValue"
Global
- EventTarget
Hosts YUI page level events. This is where events bubble to
when the broadcast config is set to 2. This property is
only available if the custom event module is loaded.
NS
- protected static {String}
Default Value: "val"
Subscriber listener sigature constant. The FLAT type returns two
parameters: the first argument passed to fire and the optional
custom object
Subscriber listener sigature constant. The LIST type returns three
parameters: the event type, the array of args passed to fire, and
the optional custom object
Configuration Attributes
axis
- writeonce { String }
Which movement axis to monitor for value association. Allowable
values are "x" and "y". This will default based
on the host Drag instance's configured stickX
or
stickY
(via DDConstrained config), or "x" if
neither is defined.
host
- writeonce { Object }
max
- { Number }
The value associated with the farthest bottom, right position of the
Drag element within its constraining element. Can be less than
the configured min
if you want values to increase from
right-to-left or bottom-to-top.
Default Value: 100
min
- { Number }
The value associated with the farthest top, left position of the
Drag element within its constraining element. Can be greater than
the configured max
if you want values to increase from
right-to-left or bottom-to-top.
Default Value: 0
value
- { Number }
The value associated with the Drag element's current position along
the axis configured in axis
. Defaults to the
value inferred from the Drag element's current position. Specifying
value in the constructor will move the Drag node to the position
that corresponds to the supplied value.
Default Value: (inferred from current Drag position)
Methods
protected
void
_afterAlign
(
e
)
Dispatch the new position of the DD into the value setting operations.
- Parameters:
-
e
< EventFacade >
The drag:align event
protected
void
_afterMaxChange
(
e
)
Update position according to new max value. If the new max results in
the current value being out of range, the value is set to the closer of
min or max.
- Parameters:
-
e
< EventFacade >
The max
attribute change event.
protected
void
_afterMinChange
(
e
)
Update position according to new min value. If the new min results in
the current value being out of range, the value is set to the closer of
min or max.
- Parameters:
-
e
< EventFacade >
The min
attribute change event.
protected
void
_afterValueChange
(
e
)
Propagate change to the DD unless the change is coming from a DD event.
- Parameters:
-
e
< EventFacade >
The value
attribute change event.
protected
void
_cacheOffset
(
)
Captures the current top left of the DD's constraining node or region to
avoid excessive DOM lookups at run time.
protected
void
_calculateFactor
(
)
Calculates and caches (range between max and min) / (constraining node
or region width or height) for fast runtime calculation of position
-> value.
protected
Y.Plugin.DDConstrained
_defaultConstrain
(
)
Plugs in Y.Plugin.DDConstrained onto the Drag instance. Default
configuration uses constrain
set to the
dragNode
's parentNode
.
- Returns:
Y.Plugin.DDConstrained
- The plugin instance
protected
mixed
_getValueFromPosition
(
)
Calculate the value from the current Drag element's position. This is
used to initialize the value attribute if it isn't set at construction.
- Returns:
mixed
- Value as calculated from the node's current position
protected
String
_initAxis
(
)
Discover the appropriate axis to associate the value to based on the
the assignment of stickX
or stickY
attributes
in the DDConstrained plugin. If neither are set, defaults to "x".
- Returns:
String
- "x" or "y"
protected
Number
_nearestValue
(
value
)
Returns the nearest valid value to the value input. If the provided
value is outside the min - max range, accounting for min > max
scenarios, the nearest of either min or max is returned. Otherwise, the
provided value is returned.
- Parameters:
-
value
< mixed >
Value to test against current min - max range
- Returns:
Number
- Current min, max, or value if within range
protected
mixed
_offsetToValue
(
X
)
Converts a pixel position into a value. Calculates current
position minus xy offsets of the constraining element multiplied by the
ratio of (max - min) / (constraining dim)
.
Override this if you want to use a different value mapping
algorithm.
- Parameters:
-
X
< Number >
or Y pixel position
- Returns:
mixed
- Value corresponding to the provided pixel position
protected
void
_setPosition
(
)
Positions the Drag element in accordance with the translated value.
protected
Boolean
_validateNewAxis
(
value
)
Validates new values assigned to axis
attribute.
Acceptable values are "x" and "y".
- Parameters:
-
value
< String >
proposed value
- Returns:
Boolean
- True if value is "x" or "y"
protected
Boolean
_validateNewMax
(
value
)
Validates new values assigned to max
attribute. Numbers
are acceptable. Override this to enforce different rules.
- Parameters:
-
value
< mixed >
Value assigned to max
attribute.
- Returns:
Boolean
- True for numbers. False otherwise.
protected
Boolean
_validateNewMin
(
value
)
Validates new values assigned to min
attribute. Numbers
are acceptable. Override this to enforce different rules.
- Parameters:
-
value
< mixed >
Value assigned to min
attribute.
- Returns:
Boolean
- True for numbers. False otherwise.
protected
Boolean
_validateNewValue
(
value
)
Validates new values assigned to value
attribute. Numbers
between the configured min
and max
are
acceptable.
- Parameters:
-
value
< mixed >
Value assigned to value
attribute.
- Returns:
Boolean
- True if value is a number between the configured
min
and max
.
protected
Array
_valueToOffset
(
val
)
Converts a value into a positional pixel value for use in positioning
the DD element according to the reverse of the
_offsetToValue( xy )
operation.
- Parameters:
-
val
< Number >
The value to map to pixel X or Y position
- Returns:
Array
[ Xpx, Ypx ] positional values
protected
void
_verifyValue
(
)
Verifies that the current value is within the min - max range. If not,
value is set to either min or max, depending on which is closer.
YUI
add
(
name
,
fn
,
version
,
details
)
Registers a module with the YUI global. The easiest way to create a
first-class YUI module is to use the YUI component build tool.
http://yuilibrary.com/projects/builder
The build system will produce the YUI.add wrapper for you module, along
with any configuration info required for the module.
- Parameters:
-
name
<string>
module name
-
fn
<Function>
entry point into the module that
is used to bind module to the YUI instance
-
version
<string>
version string
-
details
<object>
optional config data:
requires: features that must be present before this module can be attached.
optional: optional features that should be present if loadOptional is
defined. Note: modules are not often loaded this way in YUI 3,
but this field is still useful to inform the user that certain
features in the component will require additional dependencies.
use: features that are included within this module which need to be
be attached automatically when this module is attached. This
supports the YUI 3 rollup system -- a module with submodules
defined will need to have the submodules listed in the 'use'
config. The YUI component build tool does this for you.
- Returns:
YUI
- the YUI instance
void
addListener
(
)
Calls Y.Event.detach with the correct argument order
after
(
type
,
fn
,
target
,
extra
,
context
,
args*
)
after() is a unified interface for subscribing to
most events exposed by YUI. This includes custom events,
DOM events, and AOP events. This works the same way as
the on() function, only it operates after any default
behavior for the event has executed. @see on
for more
information.
- Parameters:
-
type
<object>
event type (this parameter does not apply for function events)
-
fn
<object>
the callback
-
target
<object>
a descriptor for the target (applies to custom events only).
For function events, this is the object that contains the function to
execute.
-
extra
<object>
0..n Extra information a particular event may need. These
will be documented with the event. In the case of function events, this
is the name of the function to execute on the host. In the case of
delegate listeners, this is the event delegation specification.
-
context
<object>
optionally change the value of 'this' in the callback
-
args*
<object>
0..n additional arguments to pass to the callback.
- Returns:
- the event target or a detach handle per 'chain' config
object
applyTo
(
id
,
method
,
args
)
Executes a method on a YUI instance with
the specified id if the specified method is whitelisted.
- Parameters:
-
id
<string>
the YUI instance id
-
method
<string>
the name of the method to exectute.
Ex: 'Object.keys'
-
args
<Array>
the arguments to apply to the method
- Returns:
object
- the return value from the applied method or null
Function
cached
(
source
,
cache
,
refetch
)
Returns a wrapper for a function which caches the
return value of that function, keyed off of the combined
argument values.
- Parameters:
-
source
<function>
the function to memoize
-
cache
<object>
an optional cache seed
-
refetch
<object>
if supplied, this value is tested against the cached
value. If the values are equal, the wrapped function is executed again.
- Returns:
Function
- the wrapped function
EventHandle
delegate
(
type
,
fn
,
el
,
spec
,
context
,
args*
)
Sets up event delegation on a container element. The delegated event
will use a supplied selector to test if the target or one of the
descendants of the target match it. The supplied callback function
will only be executed if a match was encountered, and, in fact,
will be executed for each element that matches if you supply an
ambiguous selector.
The event object for the delegated event is supplied to the callback
function. It is modified slightly in order to support all properties
that may be needed for event delegation. 'currentTarget' is set to
the element that matched the delegation specifcation. 'container' is
set to the element that the listener is bound to (this normally would
be the 'currentTarget').
- Parameters:
-
type
<string>
the event type to delegate
-
fn
<function>
the callback function to execute. This function
will be provided the event object for the delegated event.
-
el
<string|node>
the element that is the delegation container
-
spec
<string>
a selector that must match the target of the
event.
-
context
<object>
optional argument that specifies what 'this' refers to.
-
args*
<object>
0..n additional arguments to pass on to the callback function.
These arguments will be added after the event object.
- Returns:
EventHandle
- the detach handle
protected
void
destructor
(
)
Detach event listeners.
YUI
error
(
msg
,
e
)
Report an error. The reporting mechanism is controled by
the 'throwFail' configuration attribute. If throwFail is
not specified, the message is written to the Logger, otherwise
a JS error is thrown
- Parameters:
-
msg
<string>
the error message
-
e
<Error>
Optional JS error that was caught. If supplied
and throwFail is specified, this error will be re-thrown.
- Returns:
YUI
- this YUI instance
static
int
getCharCode
(
ev
)
Returns the charcode for an event
- Parameters:
-
ev
<Event>
the event
- Returns:
int
- the event's charCode
static
int
getPageX
(
ev
)
Returns the event's pageX
- Parameters:
-
ev
<Event>
the event
- Returns:
int
- the event's pageX
static
int
getPageY
(
ev
)
Returns the event's pageY
- Parameters:
-
ev
<Event>
the event
- Returns:
int
- the event's pageY
static
HTMLElement
getRelatedTarget
(
ev
)
Returns the event's related target
- Parameters:
-
ev
<Event>
the event
- Returns:
HTMLElement
- the event's relatedTarget
static
HTMLElement
getTarget
(
ev
,
resolveTextNode
)
Returns the event's target element. Safari sometimes provides
a text node, and this is automatically resolved to the text
node's parent so that it behaves like other browsers.
- Parameters:
-
ev
<Event>
the event
-
resolveTextNode
<boolean>
when set to true the target's
parent will be returned if the target is a
text node. @deprecated, the text node is
now resolved automatically
- Returns:
HTMLElement
- the event's target
static
Date
getTime
(
ev
)
Returns the time of the event. If the time is not included, the
event is modified using the current time.
- Parameters:
-
ev
<Event>
the event
- Returns:
Date
- the time of the event
static
[x, y]
getXY
(
ev
)
Returns the pageX and pageY properties as an indexed array.
- Parameters:
-
ev
<Event>
the event
- Returns:
[x, y]
- the pageX and pageY properties of the event
string
guid
(
pre
)
Generate an id that is unique among all YUI instances
- Parameters:
-
pre
<string>
optional guid prefix
- Returns:
string
- the guid
protected
void
initializer
(
)
Attach event listeners to keep the UI in sync with the min/max/value
attributes and DD position, then call syncDragNode() to sync initial state.
object
later
(
when
,
o
,
fn
,
data
,
periodic
)
Executes the supplied function in the context of the supplied
object 'when' milliseconds later. Executes the function a
single time unless periodic is set to true.
- Parameters:
-
when
<int>
the number of milliseconds to wait until the fn
is executed.
-
o
<object>
the context object.
-
fn
<Function|String>
the function to execute or the name of
the method in the 'o' object to execute.
-
data
<object>
[Array] data that is provided to the function. This accepts
either a single item or an array. If an array is provided, the
function is executed with one parameter for each array item. If
you need to pass a single array parameter, it needs to be wrapped in
an array [myarray].
-
periodic
<boolean>
if true, executes continuously at supplied
interval until canceled.
- Returns:
object
- a timer object. Call the cancel() method on this object to
stop the timer.
YUI
log
(
msg
,
cat
,
src
,
silent
)
If the 'debug' config is true, a 'yui:log' event will be
dispatched, which the Console widget and anything else
can consume. If the 'useBrowserConsole' config is true, it will
write to the browser console if available. YUI-specific log
messages will only be present in the -debug versions of the
JS files. The build system is supposed to remove log statements
from the raw and minified versions of the files.
- Parameters:
-
msg
<String>
The message to log.
-
cat
<String>
The log category for the message. Default
categories are "info", "warn", "error", time".
Custom categories can be used as well. (opt)
-
src
<String>
The source of the the message (opt)
-
silent
<boolean>
If true, the log event won't fire
- Returns:
YUI
- YUI instance
object
merge
(
arguments
)
Returns a new object containing all of the properties of
all the supplied objects. The properties from later objects
will overwrite those in earlier objects. Passing in a
single object will create a shallow copy of it. For a deep
copy, use clone.
- Parameters:
-
arguments
<Object*>
the objects to merge
- Returns:
object
- the new merged object
YUI
message
(
msg
,
cat
,
src
,
silent
)
Write a system message. This message will be preserved in the
minified and raw versions of the YUI files, unlike log statements.
- Parameters:
-
msg
<String>
The message to log.
-
cat
<String>
The log category for the message. Default
categories are "info", "warn", "error", time".
Custom categories can be used as well. (opt)
-
src
<String>
The source of the the message (opt)
-
silent
<boolean>
If true, the log event won't fire
- Returns:
YUI
- YUI instance
object
mix
(
r
,
s
,
ov
,
wl
,
mode
,
merge
)
Applies the supplier's properties to the receiver. By default
all prototype and static propertes on the supplier are applied
to the corresponding spot on the receiver. By default all
properties are applied, and a property that is already on the
reciever will not be overwritten. The default behavior can
be modified by supplying the appropriate parameters.
- Parameters:
-
r
<Function>
the object to receive the augmentation
-
s
<Function>
the object that supplies the properties to augment
-
ov
<boolean>
if true, properties already on the receiver
will be overwritten if found on the supplier.
-
wl
<string[]>
a whitelist. If supplied, only properties in
this list will be applied to the receiver.
-
mode
<int>
what should be copies, and to where
default(0): object to object
1: prototype to prototype (old augment)
2: prototype to prototype and object props (new augment)
3: prototype to object
4: object to prototype
-
merge
<boolean/int>
merge objects instead of overwriting/ignoring. A value of 2
will skip array merge
Used by Y.aggregate
- Returns:
object
- the augmented object
object
namespace
(
arguments
)
Returns the namespace specified and creates it if it doesn't exist
YUI.namespace("property.package");
YUI.namespace("YAHOO.property.package");
Either of the above would create YUI.property, then
YUI.property.package (YAHOO is scrubbed out, this is
to remain compatible with YUI2)
Be careful when naming packages. Reserved words may work in some browsers
and not others. For instance, the following will fail in Safari:
YUI.namespace("really.long.nested.namespace");
This fails because "long" is a future reserved word in ECMAScript
- Parameters:
-
arguments
<string*>
1-n namespaces to create
- Returns:
object
- A reference to the last namespace object created
on
(
type**
,
fn
,
target**
,
extra**
,
context
,
args*
)
YUI
's
on
method is a unified interface for subscribing to
most events exposed by YUI. This includes custom events, DOM events, and
function events.
detach
is also provided to remove listeners
serviced by this function.
The signature that
on
accepts varies depending on the type
of event being consumed. Refer to the specific methods that will
service a specific request for additional information about subscribing
to that type of event.
- Custom events. These events are defined by various
modules in the library. This type of event is delegated to
EventTarget
's on
method.
- The type of the event
- The callback to execute
- An optional context object
- 0..n additional arguments to supply the callback.
Example:
Y.on('domready', function() { // start work });
- DOM events. These are moments reported by the browser related
to browser functionality and user interaction.
This type of event is delegated to
Event
's
attach
method.
- The type of the event
- The callback to execute
- The specification for the Node(s) to attach the listener
to. This can be a selector, collections, or Node/Element
refereces.
- An optional context object
- 0..n additional arguments to supply the callback.
Example:
Y.on('click', function(e) { // something was clicked }, '#someelement');
- Function events. These events can be used to react before or after a
function is executed. This type of event is delegated to
Event.Do
's
before
method.
- The callback to execute
- The object that has the function that will be listened for.
- The name of the function to listen for.
- An optional context object
- 0..n additional arguments to supply the callback.
Example Y.on(function(arg1, arg2, etc) { // obj.methodname was executed }, obj 'methodname');
on
corresponds to the moment before any default behavior of
the event.
after
works the same way, but these listeners
execute after the event's default behavior.
before
is an
alias for
on
.
- Parameters:
-
type**
<object>
event type (this parameter does not apply for function events)
-
fn
<object>
the callback
-
target**
<object>
a descriptor for the target (applies to custom events only).
For function events, this is the object that contains the function to
execute.
-
extra**
<object>
0..n Extra information a particular event may need. These
will be documented with the event. In the case of function events, this
is the name of the function to execute on the host. In the case of
delegate listeners, this is the event delegation specification.
-
context
<object>
optionally change the value of 'this' in the callback
-
args*
<object>
0..n additional arguments to pass to the callback.
- Returns:
- the event target or a detach handle per 'chain' config
once
(
type**
,
fn
,
target**
,
extra**
,
context
,
args*
)
Listen for an event one time. Equivalent to on
, except that
the listener is immediately detached when executed.
- Parameters:
-
type**
<object>
event type (this parameter does not apply for function events)
-
fn
<object>
the callback
-
target**
<object>
a descriptor for the target (applies to custom events only).
For function events, this is the object that contains the function to
execute.
-
extra**
<object>
0..n Extra information a particular event may need. These
will be documented with the event. In the case of function events, this
is the name of the function to execute on the host. In the case of
delegate listeners, this is the event delegation specification.
-
context
<object>
optionally change the value of 'this' in the callback
-
args*
<object>
0..n additional arguments to pass to the callback.
- Returns:
- the event target or a detach handle per 'chain' config
static
void
preventDefault
(
ev
)
Prevents the default behavior of the event
- Parameters:
-
ev
<Event>
the event
void
removeListener
(
)
Calls Y.Event.attach with the correct argument order
static
HTMLElement
resolveTextNode
(
node
)
In some cases, some browsers will return a text node inside
the actual element that was targeted. This normalizes the
return value for getTarget and getRelatedTarget.
- Parameters:
-
node
<HTMLElement>
node to resolve
- Returns:
HTMLElement
- the normized node
static
void
simulate
(
target
,
type
,
options
)
Simulates the event with the given name on a target.
- Parameters:
-
target
<HTMLElement>
The DOM element that's the target of the event.
-
type
<String>
The type of event to simulate (i.e., "click").
-
options
<Object>
(Optional) Extra options to copy onto the event object.
string
stamp
(
o
,
readOnly
)
Returns a guid associated with an object. If the object
does not have one, a new one is created unless readOnly
is specified.
- Parameters:
-
o
<object>
The object to stamp
-
readOnly
<boolean>
if true, a valid guid will only
be returned if the object has one assigned to it.
- Returns:
string
- The object's guid or null
static
void
stopEvent
(
ev
)
Convenience method for stopPropagation + preventDefault
- Parameters:
-
ev
<Event>
the event
static
void
stopPropagation
(
ev
)
Stops event propagation
- Parameters:
-
ev
<Event>
the event
void
syncDragNode
(
)
Cache constraining element offsets and dims for faster value translation
and map current DD position to value.
function
throttle
(
fn
,
ms
)
Throttles a call to a method based on the time between calls.
- Parameters:
-
fn
<function>
The function call to throttle.
-
ms
<int>
The number of milliseconds to throttle the method call. Can set
globally with Y.config.throttleTime or by call. Passing a -1 will disable the throttle. Defaults to 150
- Returns:
function
- Returns a wrapped function that calls fn throttled.
YUI
use
(
modules*
,
*callback
)
Attaches one or more modules to the YUI instance. When this
is executed, the requirements are analyzed, and one of
several things can happen:
- All requirements are available on the page -- The modules
are attached to the instance. If supplied, the use callback
is executed synchronously.
- Modules are missing, the Get utility is not available OR
the 'bootstrap' config is false -- A warning is issued about
the missing modules and all available modules are attached.
- Modules are missing, the Loader is not available but the Get
utility is and boostrap is not false -- The loader is bootstrapped
before doing the following....
- Modules are missing and the Loader is available -- The loader
expands the dependency tree and fetches missing modules. When
the loader is finshed the callback supplied to use is executed
asynchronously.
- Parameters:
-
modules*
<string>
1-n modules to bind (uses arguments array)
-
*callback
<function>
callback function executed when
the instance has the required functionality. If included, it
must be the last parameter.
// loads and attaches drag and drop and its dependencies
YUI().use('dd', function(Y) {});
// attaches all modules that are available on the page
YUI().use('*', function(Y) {});
// intrinsic YUI gallery support (since 3.1.0)
YUI().use('gallery-yql', function(Y) {});
// intrinsic YUI 2in3 support (since 3.1.0)
YUI().use('yui2-datatable', function(Y) {});
- Returns:
YUI
- the YUI instance
Events
available
(
type
,
fn
,
el
,
context
,
args*
)
Executes the callback as soon as the specified element
is detected in the DOM.
- Parameters:
-
type<string>
'available'
-
fn<function>
the callback function to execute.
-
el<string|HTMLElement|collection>
the element(s) to attach
-
context<object>
optional argument that specifies what 'this' refers to.
-
args*<object>
0..n additional arguments to pass on to the callback function.
These arguments will be added after the event object.
axisChange
(
event
)
Fires when the value for the configuration attribute 'axis' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
blur
(
type
,
fn
,
o
,
context
,
args
)
Adds a DOM blur listener. Uses the focusout event in IE,
DOMFocusOut for Opera and Webkit, and the capture phase for Gecko so that
the event propagates in a way that enables event delegation.
- Parameters:
-
type<string>
'blur'
-
fn<function>
the callback function to execute
-
o<string|HTMLElement|collection>
the element(s) to bind
-
context<object>
optional context object
-
args<object>
0..n additional arguments to provide to the listener.
contentready
(
type
,
fn
,
el
,
context
,
args*
)
Executes the callback as soon as the specified element
is detected in the DOM with a nextSibling property
(indicating that the element's children are available)
- Parameters:
-
type<string>
'contentready'
-
fn<function>
the callback function to execute.
-
el<string|HTMLElement|collection>
the element(s) to attach
-
context<object>
optional argument that specifies what 'this' refers to.
-
args*<object>
0..n additional arguments to pass on to the callback function.
These arguments will be added after the event object.
domready
(
)
The domready event fires at the moment the browser's DOM is
usable. In most cases, this is before images are fully
downloaded, allowing you to provide a more responsive user
interface.
In YUI 3, domready subscribers will be notified immediately if
that moment has already passed when the subscription is created.
One exception is if the yui.js file is dynamically injected into
the page. If this is done, you must tell the YUI instance that
you did this in order for DOMReady (and window load events) to
fire normally. That configuration option is 'injected' -- set
it to true if the yui.js script is not included inline.
This method is part of the 'event-ready' module, which is a
submodule of 'event'.
focus
(
type
,
fn
,
o
,
context
,
args
)
Adds a DOM focus listener. Uses the focusin event in IE,
DOMFocusIn for Opera and Webkit, and the capture phase for Gecko so that
the event propagates in a way that enables event delegation.
- Parameters:
-
type<string>
'focus'
-
fn<function>
the callback function to execute
-
o<string|HTMLElement|collection>
the element(s) to bind
-
context<object>
optional context object
-
args<object>
0..n additional arguments to provide to the listener.
hostChange
(
event
)
Fires when the value for the configuration attribute 'host' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
key
(
type
,
fn
,
id
,
spec
,
o
,
args
)
Add a key listener. The listener will only be notified if the
keystroke detected meets the supplied specification. The
spec consists of the key event type, followed by a colon,
followed by zero or more comma separated key codes, followed
by zero or more modifiers delimited by a plus sign. Ex:
press:12,65+shift+ctrl
- Parameters:
-
type<string>
'key'
-
fn<function>
the function to execute
-
id<string|HTMLElement|collection>
the element(s) to bind
-
spec<string>
the keyCode and modifier specification
-
o<object>
optional context object
-
args<object>
0..n additional arguments to provide to the listener.
maxChange
(
event
)
Fires when the value for the configuration attribute 'max' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
minChange
(
event
)
Fires when the value for the configuration attribute 'min' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
mouseenter
(
type
,
fn
,
el
,
spec
)
Sets up a "mouseenter" listenera listener that is called the first time
the user's mouse enters the specified element(s).
- Parameters:
-
type<string>
"mouseenter"
-
fn<function>
The method the event invokes.
-
el<string|node>
The element(s) to assign the listener to.
-
spec<string>
Optional. String representing a selector that must
match the target of the event in order for the listener to be called.
mouseleave
(
type
,
fn
,
el
,
spec
)
Sets up a "mouseleave" listenera listener that is called the first time
the user's mouse leaves the specified element(s).
- Parameters:
-
type<string>
"mouseleave"
-
fn<function>
The method the event invokes.
-
el<string|node>
The element(s) to assign the listener to.
-
spec<string>
Optional. String representing a selector that must
match the target of the event in order for the listener to be called.
mousewheel
(
type
,
fn
,
context
,
args
)
Mousewheel event. This listener is automatically attached to the
correct target, so one should not be supplied. Mouse wheel
direction and velocity is stored in the 'mouseDelta' field.
- Parameters:
-
type<string>
'mousewheel'
-
fn<function>
the callback to execute
-
context<object>
optional context object
-
args<object>
0..n additional arguments to provide to the listener.
valueChange
(
event
)
Fires when the value for the configuration attribute 'value' is changed. You can listen for the event using the
on method if you wish to be notified before the attribute's value has changed, or using the
after method if you wish to be notified after the attribute's value has changed.
- Parameters:
-
event<Event.Facade>
An Event Facade object with the following attribute specific properties added: - prevVal
- The value of the attribute, prior to it being set
- newVal
- The value the attribute is to be set to
- attrName
- The name of the attribute being set
- subAttrName
- If setting a property within the attribute's value, the name of the sub-attribute property being set
windowresize
(
)
Firefox fires the window resize event once when the resize action
finishes, other browsers fire the event periodically during the
resize. This code uses timeout logic to simulate the Firefox
behavior in other browsers.