YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

Yahoo! UI Library

YAHOO Global  2.9.0

Yahoo! UI Library > yahoo > YAHOO
Search:
 
Filters

static Class YAHOO

The YAHOO global namespace object. If YAHOO is already defined, the existing YAHOO object will not be overwritten so that defined namespaces are preserved.

Methods

augment

static void augment ( r , s , arguments )
An alias for YAHOO.lang.augment
Parameters:
r <Function> the object to receive the augmentation
s <Function> the object that supplies the properties to augment
arguments <String*> zero or more properties methods to augment the receiver with. If none specified, everything in the supplier will be used unless it would overwrite an existing property in the receiver

extend

static void extend ( subc , superc , overrides )
An alias for YAHOO.lang.extend
Parameters:
subc <Function> the object to modify
superc <Function> the object to inherit
overrides <Object> additional properties/methods to add to the subclass prototype. These will override the matching items obtained from the superclass if present.

log

static Boolean log ( msg , cat , src )
Uses YAHOO.widget.Logger to output a log message, if the widget is available. Note: LogReader adds the message, category, and source to the DOM as HTML.
Parameters:
msg <HTML> The message to log.
cat <HTML> The log category for the message. Default categories are "info", "warn", "error", time". Custom categories can be used as well. (opt)
src <HTML> The source of the the message (opt)
Returns: Boolean
True if the log operation was successful.

namespace

static Object namespace ( arguments )
Returns the namespace specified and creates it if it doesn't exist
YAHOO.namespace("property.package");
YAHOO.namespace("YAHOO.property.package");
Either of the above would create YAHOO.property, then YAHOO.property.package Be careful when naming packages. Reserved words may work in some browsers and not others. For instance, the following will fail in Safari:
YAHOO.namespace("really.long.nested.namespace");
This fails because "long" is a future reserved word in ECMAScript For implementation code that uses YUI, do not create your components in the namespaces defined by YUI ( YAHOO.util, YAHOO.widget, YAHOO.lang, YAHOO.tool, YAHOO.example, YAHOO.env) -- create your own namespace (e.g., 'companyname').
Parameters:
arguments <String*> 1-n namespaces to create
Returns: Object
A reference to the last namespace object created

register

static void register ( name , mainClass , data )
Registers a module with the YAHOO object
Parameters:
name <String> the name of the module (event, slider, etc)
mainClass <Function> a reference to class in the module. This class will be tagged with the version info so that it will be possible to identify the version that is in use when multiple versions have loaded
data <Object> metadata object for the module. Currently it is expected to contain a "version" property and a "build" property at minimum.


Copyright © 2011 Yahoo! Inc. All rights reserved.