yui.js revision f6d14b3bf6e08e09949f6a1e7d5431b7829f3550
(function() {
var _instances = {},
// @TODO: this needs to be created at build time from module metadata
'io.xdrReady': 1,
'io.start': 1,
'io.success': 1,
'io.failure': 1,
'io.abort': 1
};
/**
* The YUI global namespace object. If YUI is already defined, the
* existing YUI object will not be overwritten so that defined
* namespaces are preserved.
* @class YUI
* @constructor
* @global
* @uses Event.Target
* @param o configuration object
*/
/*global YUI*/
YUI = function(o) {
var Y = this;
// Allow var yui = YUI() instead of var yui = new YUI()
if (Y == window) {
return new YUI(o);
} else {
// set up the core environment
Y._init(o);
// bind the specified additional modules for this instance
Y._setup();
}
};
}
// The prototype contains the functions that are required to allow the external
// modules to be registered and for the instance to be initialized.
/**
* Initialize this YUI instance
* @param o config options
* @private
*/
_init: function(o) {
// @todo
// loadcfg {
// base
// securebase
// filter
// win
// doc
// debug
// useConsole
// logInclude
// logExclude
// throwFail
// pollInterval
// core
// }
o = o || {};
// find targeted window and @TODO create facades
o.win = w;
// add a reference to o for anything that needs it
// before _setup is called.
this.config = o;
this.Env = {
// @todo expand the new module metadata
mods: {},
_idx: 0,
_pre: 'yuid',
_used: {},
_yidx: 0,
_uidx: 0
};
_instances[this.id] = this;
}
this.constructor = YUI;
},
/**
* Finishes the instance setup. Attaches whatever modules were defined
* when the yui modules was registered.
* @method _setup
* @private
*/
_setup: function(o) {
this.use("yui");
// make a shallow copy of the config. This won't fix nested configs
// so we need to determine if we only allow one level (probably) or
// if we make clone create references for functions and elements.
// this.mix(c, {
// debug: true,
// useConsole: true
// // , throwFail: false
// });
// this.config = c;
// this.publish('yui:load');
// this.publish('yui:log', {
// silent: true
// });
},
/**
* Executes a method on a YUI instance with
* the specified id.
* @method applyTo
* @param id {string} the YUI instance id
* @param method {string} the name of the method to exectute.
* Ex: 'Object.keys'
* @param args {Array} the arguments to apply to the method
* @return the return value from the applied method or null
*/
if (!(method in _APPLY_TO_WHITE_LIST)) {
return null;
}
if (instance) {
m = m[nest[i]];
if (!m) {
}
}
}
return null;
},
/**
* Register a module
* @method add
* @param name {string} module name
* @param namespace {string} name space for the module
* @param fn {Function} entry point into the module that
* is used to bind module to the YUI instance
* @param version {string} version string
* @return {YUI} the YUI instance
*
* requires - features that should be present before loading
* optional - optional features that should be present if load optional defined
* use - features that should be attached automatically
* skinnable -
* rollup
* omit - features that should not be loaded if this module is present
*/
// @todo expand this to include version mapping
// @todo allow requires/supersedes
// @todo may want to restore the build property
// @todo fire moduleAvailable event
var m = {
};
return this; // chain support
},
/**
* Bind a module to a YUI instance
* @param modules* {string} 1-n modules to bind (uses arguments array)
* @param *callback {function} callback function executed when
* the instance has the required functionality. If included, it
* must be the last parameter.
*
* @TODO
* Implement versioning? loader can load different versions?
* Should sub-modules/plugins be normal modules, or do
* we add syntax for specifying these?
*
* YUI().use('dragdrop')
* YUI().use('dragdrop:2.4.0'); // specific version
* YUI().use('dragdrop:2.4.0-'); // at least this version
* YUI().use('dragdrop:2.4.0-2.9999.9999'); // version range
* YUI().use('*'); // use all available modules
* YUI().use('lang+dump+substitute'); // use lang and some plugins
* YUI().use('lang+*'); // use lang and all known plugins
*
*
* @return {YUI} the YUI instance
*/
use: function() {
var Y = this,
firstArg = a[0],
dynamic = false,
sorted = false,
// The last argument supplied to use can be a load complete callback
if (typeof callback === 'function') {
a.pop();
} else {
callback = null;
}
// YUI().use('*'); // bind everything available
if (firstArg === "*") {
a = [];
for (var k in mods) {
if (mods.hasOwnProperty(k)) {
a.push(k);
}
}
if (callback) {
}
// Accept a loader instance with a pre-sorted list of dependencies
sorted = true;
}
// use loader to optimize and sort the requirements if it
// is available.
dynamic = true;
loader.ignoreRegistered = true;
}
// only attach a module once
return;
}
if (m) {
if (dynamic) {
// Y.mix(l, YUI.Env.mods);
m.fn(Y);
}
} else {
}
// make sure requirements are attached
if (req) {
f(req);
} else {
f(req[j]);
}
}
}
// add this module to full list of things to attach
// auto-attach sub-modules
if (use) {
f(req);
} else {
f(use[j]);
}
}
}
};
// process each requirement and any additional requirements
// the module metadata specifies
f(a[i]);
}
var attach = function(fromLoader) {
if (!fromLoader) {
var m = mods[r[i]];
if (m) {
m.fn(Y);
}
}
}
if (callback) {
callback(Y);
}
if (Y.fire) {
Y.fire('yui:load', Y);
}
};
// dynamic load
// loader calls use to automatically attach when finished
// but we still need to execute the callback.
// loader.subscribe('failure', function() {
// });
} else {
attach();
}
return Y; // chain support var yui = YUI().use('dragdrop');
},
/**
* Returns the namespace specified and creates it if it doesn't exist
* <pre>
* YUI.namespace("property.package");
* YUI.namespace("YUI.property.package");
* </pre>
* Either of the above would create YUI.property, then
* YUI.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:
* <pre>
* YUI.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @static
* @param {String*} arguments 1-n namespaces to create
* @return {Object} A reference to the last namespace object created
*/
namespace: function() {
var a=arguments, o=null, i, j, d;
d = a[i].split(".");
o = this;
o[d[j]] = o[d[j]] || {};
o = o[d[j]];
}
}
return o;
},
// this is replaced if the log module is included
log: function() {
},
/**
* 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
* @method fail
* @param msg {string} the failure message
* @param e {Error} Optional JS error that was caught. If supplied
* and throwFail is specified, this error will be re-thrown.
* @return {YUI} this YUI instance
*/
}
return this;
},
/**
* Generate an id that is unique among all YUI instances
* @method guid
* @param pre {string} optional guid prefix
* @return {string} the guid
*/
},
/**
* Stamps an object with a guid. If the object already
* has one, a new one is not created
* @method stamp
* @param o The object to stamp
* @return {string} The object's guid
*/
stamp: function(o) {
if (!o) {
return o;
}
if (!uid) {
}
return uid;
}
};
// Give the YUI global the same properties as an instance.
// This makes it so that the YUI global can be used like the YAHOO
// global was used prior to 3.x. More importantly, the YUI global
// provides global metadata, so env needs to be configured.
// @TODO review
// inheritance utilities are not available yet
for (i in p) {
if (true) { // hasOwnProperty not available yet and not needed
Y[i] = p[i];
}
}
// set up the environment
Y._init();
})();
/**
* If the 'debug' config is true, a 'yui:log' event will be
* dispatched, which the logger widget and anything else
* can consume. If the 'useConsole' config is true, it will
* write to the browser console if available.
*
* @method log
* @static
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @return {YUI} YUI instance
*/
// suppress log message if the config is off or the event stack
// or the event call stack contains a consumer of the yui:log event
// apply source filters
if (src) {
// console.log('checking src filter: ' + src + ', inc: ' + inc + ', exc: ' + exc);
// console.log('bail: inc list found, but src is not in list: ' + src);
bail = true;
// console.log('bail: exc list found, and src is in it: ' + src);
bail = true;
}
}
if (!bail) {
console[f](m);
}
}
// category filters are not used to suppress the log event
// so that the data can be stored and displayed later.
if (Y.fire) {
}
}
return Y;
};
}, "@VERSION@");
/**
* Provides the language utilites and extensions used by the library
* @class Lang
*/
/**
* Determines whether or not the provided object is an array.
* Testing typeof/instanceof/constructor of arrays across frame
* boundaries isn't possible in Safari unless you have a reference
* to the other frame to test against its Array prototype. To
* handle this case, we test well-known array properties instead.
* properties.
* @TODO can we kill this cross frame hack?
* @method isArray
* @param {any} o The object being testing
* @return Boolean
*/
L.isArray = function(o) {
if (o) {
//return L.isNumber(o.length) && L.isFunction(o.splice);
}
return false;
};
/**
* Determines whether or not the provided object is a boolean
* @method isBoolean
* @param {any} o The object being testing
* @return Boolean
*/
L.isBoolean = function(o) {
return typeof o === 'boolean';
};
/**
* Determines whether or not the provided object is a function
* @method isFunction
* @param {any} o The object being testing
* @return Boolean
*/
L.isFunction = function(o) {
return typeof o === 'function';
};
L.isDate = function(o) {
return o instanceof Date;
};
/**
* Determines whether or not the provided object is null
* @method isNull
* @param {any} o The object being testing
* @return Boolean
*/
L.isNull = function(o) {
return o === null;
};
/**
* Determines whether or not the provided object is a legal number
* @method isNumber
* @param {any} o The object being testing
* @return Boolean
*/
L.isNumber = function(o) {
return typeof o === 'number' && isFinite(o);
};
/**
* Determines whether or not the provided object is of type object
* or function
* @method isObject
* @param {any} o The object being testing
* @param failfn {boolean} fail if the input is a function
* @return Boolean
*/
};
/**
* Determines whether or not the provided object is a string
* @method isString
* @param {any} o The object being testing
* @return Boolean
*/
L.isString = function(o) {
return typeof o === 'string';
};
/**
* Determines whether or not the provided object is undefined
* @method isUndefined
* @param {any} o The object being testing
* @return Boolean
*/
L.isUndefined = function(o) {
return typeof o === 'undefined';
};
/**
* Returns a string without any leading or trailing whitespace. If
* the input is not a string, the input will be returned untouched.
* @method trim
* @param s {string} the string to trim
* @return {string} the trimmed string
*/
L.trim = function(s){
try {
return s.replace(/^\s+|\s+$/g, "");
} catch(e) {
return s;
}
};
/**
* A convenience method for detecting a legitimate non-null value.
* including 0/false/''
* @method isValue
* @param o {any} the item to test
*/
L.isValue = function(o) {
// return (o || o === false || o === 0 || o === ''); // Infinity fails
};
}, "@VERSION@");
/**
* YUI core
* @module yui
*/
/**
* Array utilities
* @TODO investigate using Array subclasses for some of this
* @class Array
* @static
*/
/**
* Returns an array:
* - Arrays are return unmodified unless the start position is specified.
* - "Array-like" collections (@see Array.test) are converted to arrays
* - For everything else, a new array is created with the input as the sole item
* - The start position is used if the input is or is like an array to return
* a subset of the collection.
*
* @todo this will not automatically convert elements that are also collections
* such as forms and selects. Passing true as the third param will
* force a conversion.
*
* @param o the item to arrayify
* @param i {int} if an array or array-like, this is the start index
* @param al {boolean} if true, it forces the array-like fork. This
* can be used to avoid multiple array.test calls.
*/
Y.Array = function(o, i, al) {
switch (t) {
case 1:
return (i) ? o.slice(o, i) : o;
case 2:
default:
return [o];
}
};
var A = Y.Array;
// YUI array utilities. The current plan is to make a few useful
// ones 'core', and to have the rest of the array extras an optional
// module
/**
* Evaluates the input to determine if it is an array, array-like, or
* something else. This is used to handle the arguments collection
* available within functions, and HTMLElement collections
*
* @todo current implementation (intenionally) will not implicitly
* handle html elements that are array-like (forms, selects, etc).
*
* @return {int} a number indicating the results:
* 0: Not an array or an array-like collection
* 1: A real array.
* 2: array-like collection.
*/
A.test = function(o) {
var r = 0;
if (L.isObject(o, true)) {
if (L.isArray(o)) {
r = 1;
} else {
try {
// indexed, but no tagName (element) or alert (window)
if ("length" in o && !("tagName" in o) && !("alert" in o)) {
r = 2;
}
} catch(ex) {}
}
}
return r;
};
/**
* Executes the supplied function on each item in the array.
* @method each
*/
function (a, f, o) {
return Y;
} :
function (a, f, o) {
var l = a.length, i;
for (i = 0; i < l; i=i+1) {
f.call(o || Y, a[i], i, a);
}
return Y;
};
/**
* Returns an object using the first array as keys, and
* the second as values. If the second array is not
* provided the value is set to true for each.
* @method hash
* @param k {Array} keyset
* @param v {Array} optional valueset
* @return the hash
*/
A.hash = function(k, v) {
for (i=0; i<l; i=i+1) {
}
return o;
};
/**
* Returns the index of the first item in the array
* that contains the specified value, -1 if the
* value isn't found.
* @TODO use native method if avail
* @method indexOf
* @param a {Array} the array to search
* @param val the value to search for
* @return the index of the item that contains the value or -1
*/
if (a[i] === val) {
return i;
}
}
return -1;
};
}, "@VERSION@");
// requires lang
var L = Y.Lang,
A = Y.Array,
PROTO = 'prototype',
/**
* IE will not enumerate native functions in a derived object even if the
* function was overridden. This is a workaround for specific functions
* we care about on the Object prototype.
* @property _iefix
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param w a whitelist object (the keys are the valid items to reference)
* @static
* @private
* @for YUI
*/
function(r, s, w) {
var n = a[i], f = s[n];
if (L.isFunction(f) && f != OP[n]) {
if (!w || (n in w)) {
r[n]=f;
}
}
}
} : function() {};
/**
* 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.
* @method merge
* @param arguments {Object*} the objects to merge
* @return the new merged object
*/
Y.merge = function() {
// var o={}, a=arguments;
// for (var i=0, l=a.length; i<l; i=i+1) {
//var a=arguments, o=Y.Object(a[0]);
var a=arguments, o={};
Y.mix(o, a[i], true);
}
return o;
};
/**
* 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.
*
* @TODO add constants for the modes
*
* @method mix
* @static
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param ov {boolean} if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param wl {string[]} a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @param {int} mode 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
* @param merge {boolean} merge objects instead of overwriting/ignoring
* Used by Y.aggregate
* @return the augmented object
* @TODO review for PR2
*/
if (!s||!r) {
return Y;
}
for (var i in fs) {
// We never want to overwrite the prototype
// if (PROTO === i) {
if (PROTO === i || '_yuid' === i) {
continue;
}
// @TODO deal with the hasownprop issue
// check white list if it was supplied
if (!w || iwl || (i in w)) {
// if the receiver has this property, it is an object,
// and merge is specified, merge the two objects.
// console.log('aggregate RECURSE: ' + i);
// @TODO recursive or no?
// Y.mix(fr[i], fs[i]); // not recursive
// otherwise apply the property only if overwrite
// is specified or the receiver doesn't have one.
// @TODO make sure the 'arr' check isn't desructive
// console.log('hash: ' + i);
// if merge is specified and the receiver is an array,
// append the array item
} else if (arr) {
// console.log('array: ' + i);
// @TODO probably will need to remove dups
}
}
}
};
switch (mode) {
case 1: // proto to proto
break;
case 2: // object to object and proto to proto
f(r, s);
break;
case 3: // proto to static
f(r, sp, true);
break;
case 4: // static to proto
f(rp, s);
break;
default: // object to object
f(r, s);
}
return r;
};
/**
* Applies prototype properties from the supplier to the receiver.
* The receiver can be a constructor or an instance.
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param ov {boolean} if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param wl {string[]} a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @param args {Array | Any} arg or arguments to apply to the supplier
* constructor when initializing.
* @return the augmented object
*
* @todo constructor optional?
* @todo understanding what an instance is augmented with
* @TODO evaluate if we can do this in a way that doesn't interfere
* with normal inheritance
*/
// working on a class, so apply constructor infrastructure
// Y.Do.before(r, construct);
var sequestered = {}, replacements = {};
newProto = {};
// sequester all of the functions in the supplier and replace with
// one that will restore all of them.
// var initialized = false;
replacements[k] = function() {
var me = this;
// overwrite the prototype with all of the sequestered functions,
// but only if it hasn't been overridden
for (var i in sequestered) {
me[i] = sequestered[i];
}
}
// apply the constructor
// apply the original sequestered function
};
if (Y.Lang.isFunction(v)) {
// sequester the function
sequestered[k] = v;
// replace the sequestered function with a function that will
// restore all sequestered functions and exectue the constructor.
this[k] = replacements[k];
} else {
this[k] = v;
}
}
}, newProto, true);
// augmenting an instance, so apply the constructor immediately
} else {
applyConstructor = true;
}
if (applyConstructor) {
}
return r;
};
/**
* Applies object properties from the supplier to the receiver. If
* the target has the property, and the property is an object, the target
* object will be augmented with the supplier's value. If the property
* is an array, the suppliers value will be appended to the target.
*
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param ov {boolean} if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param wl {string[]} a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @return the extended object
*/
};
/**
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
* Static members will not be inherited.
*
* @method extend
* @static
* @param {Function} r the object to modify
* @param {Function} s the object to inherit
* @return {YUI} the YUI instance
*/
if (!s||!r) {
Y.fail("extend failed, verify dependencies");
}
rp.constructor=r;
r.superclass=sp;
// If the superclass doesn't have a standard constructor,
// define one so that Super() works
sp.constructor=s;
}
// Add object properties too
// @TODO removed for now because it isn't that useful and
// has caused a few issues overwriting things that should
// not be. You can do this manually if needed. Revisit
// if this is something that really is needed for some
// reason.
// Y.mix(r, s);
// Add superclass convienience functions
// @TODO revisit when we have something that works
// Y.augment(r, Ext);
// Add prototype overrides
if (px) {
}
// Add object overrides
if (sx) {
}
return r;
};
} else {
switch (A.test(o)) {
case 1:
return A.each(o, f, c);
case 2:
return A.each(Y.Array(o, 0, true), f, c);
default:
}
}
// return Y.Object.each(o, f, c);
};
/**
* Array-like objects are treated as arrays.
* primitives are returned untouched. Optionally a
* function can be provided to handle other data types,
* filter keys, validate values, etc.
*
* @method clone
* @param o what to clone
* @param safe {boolean} if true, objects will not have prototype
* items from the source. If false, it does. In this case, the
* original is initally protected, but the clone is not completely immune
* from changes to the source object prototype. Also, cloned prototype
* items that are deleted from the clone will result in the value
* of the source prototype to be exposed. If operating on a non-safe
* clone, items should be nulled out rather than deleted.
* @TODO review
* @param f optional function to apply to each item in a collection
* it will be executed prior to applying the value to
* the new object. Return false to prevent the copy.
* @param c optional execution context for f
* @param owner Owner object passed when clone is iterating an
* object. Used to set up context for cloned functions.
* @return {Array|Object} the cloned object
*/
if (!L.isObject(o)) {
return o;
}
if (L.isDate(o)) {
return new Date(o);
}
if (func) {
if (o instanceof RegExp) {
return new RegExp(o.source);
}
} else {
}
Y.each(o, function(v, k) {
if (!f || (f.call(c || this, v, k, this, o) !== false)) {
}
}, o2);
return o2;
};
/**
* Returns a function that will execute the supplied function in the
* supplied object's context, optionally adding any additional
* supplied parameters to the end of the arguments the function
* is executed with.
* @TODO review param order for PR2
* @method bind
* @param f {Function} the function to bind
* @param c the execution context
* @param args* 0..n arguments to append to the arguments collection for the function
* @return the wrapped function
*/
Y.bind = function(f, c) {
// if (!f) {
// }
var a = Y.Array(arguments, 2, true);
return function () {
// @todo bind args first, or function args first?
// return f.apply(c || f, a.concat(Y.Array(arguments, 0, true)));
};
};
/**
* Subscribes to the yui:load event, which fires when a Y.use operation
* is complete.
* @method ready
* @param f {Function} the function to execute
* @param c Optional execution context
* @param args* 0..n Additional arguments to append
* to the signature provided when the event fires.
* @return {YUI} the YUI instance
*/
Y.ready = function(f, c) {
Y.on("yui:load", m);
return this;
};
/**
* Attach an event listener, either to a DOM object
* or to an Event.Target.
* @param type {string} the event type
* @param f {Function} the function to execute
* @param o the Event.Target or element to attach to
* @param context Optional execution context
* @param args* 0..n additional arguments to append
* to the signature provided when the event fires.
* @method on
* @return {Event.Handle} a handle object for
* unsubscribing to this event.
*/
switch (cat[0]) {
default:
}
} else {
}
};
/**
* Detach an event listener (either a custom event or a
* DOM event
* @method detach
* @param type the type of event, or a Event.Handle to
* for the subscription. If the Event.Handle is passed
* in, the other parameters are not used.
* @param f {Function} the subscribed function
* @param o the object or element the listener is subscribed
* to.
* @method detach
* @return {YUI} the YUI instance
*/
switch (cat[0]) {
default:
}
} else {
}
};
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method.
*
* For DOM and custom events:
* type, callback, context, 1-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 1-n arguments
*
* @method before
* @return unsubscribe handle
*/
// method override
// callback, object, sMethod
}
return Y;
};
/**
* Executes the callback after a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method.
*
* @TODO add event
*
* For DOM and custom events:
* type, callback, context, 1-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 1-n arguments
*
* @method after
* @return unsubscribe handle
*/
}
return Y;
};
}, "@VERSION@");
/**
* Object utils
* @class Object
*/
/**
* Returns a new object based upon the supplied object. By
* default the new object's prototype will have all members
* on the object.tructor prototype.
* @param The supplier object
* @return the new object
*/
Y.Object = function(o) {
var F = function() {};
F.prototype = o;
return new F();
};
var O = Y.Object, L = Y.Lang;
/**
* Determines whether or not the property was added
* to the object instance. Returns false if the property is not present
* in the object, or was inherited from the prototype.
*
* @deprecated Safari 1.x support has been removed, so this is simply a
* wrapper for the native implementation. Use the native implementation
* directly instead.
*
* @TODO Remove in PR2
*
* @method owns
* @param o {any} The object being testing
* @parma p {string} the property to look for
* @return {boolean} true if the object has the property on the instance
*/
O.owns = function(o, p) {
return (o && o.hasOwnProperty) ? o.hasOwnProperty(p) : false;
};
/**
* Returns an array containing the object's keys
* @method keys
* @param o an object
* @return {string[]} the keys
*/
O.keys = function(o) {
var a=[], i;
for (i in o) {
if (O.owns(o, i)) {
a.push(i);
}
}
return a;
};
/**
* Executes a function on each item. The function
* receives the value, the key, and the object
* as paramters (in that order).
* @param o the object to iterate
* @param f {function} the function to execute
* @param c the execution context
* @param proto {boolean} include proto
* @return {YUI} the YUI instance
*/
var s = c || Y;
for (var i in o) {
f.call(s, o[i], i, o);
}
}
return Y;
};
}, "@VERSION@");
/**
* @class UA
*/
Y.UA = function() {
var o={
/**
* Internet Explorer version number or 0. Example: 6
* @property ie
* @type float
*/
ie:0,
/**
* Opera version number or 0. Example: 9.2
* @property opera
* @type float
*/
opera:0,
/**
* Gecko engine revision number. Will evaluate to 1 if Gecko
* is detected but the revision could not be found. Other browsers
* will be 0. Example: 1.8
* <pre>
* Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
* Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
* Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
* Firefox 3 alpha: 1.9a4 <-- Reports 1.9
* </pre>
* @property gecko
* @type float
*/
gecko:0,
/**
* AppleWebKit version. KHTML browsers that are not WebKit browsers
* will evaluate to 1, other browsers 0. Example: 418.9.1
* <pre>
* Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
* latest available for Mac OSX 10.3.
* Safari 2.0.2: 416 <-- hasOwnProperty introduced
* Safari 2.0.4: 418 <-- preventDefault fixed
* Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
* different versions of webkit
* Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
* updated, but not updated
* to the latest patch.
* Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native SVG
* and many major issues fixed).
* Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic update
* from 2.x via the 10.4.11 OS patch
*
* </pre>
* @property webkit
* @type float
*/
webkit:0,
/**
* The mobile property will be set to a string containing any relevant
* user agent information when a modern mobile browser is detected.
* devices with the WebKit-based browser, and Opera Mini.
* @property mobile
* @type string
*/
mobile: null
};
// Modern KHTML browsers should qualify as Safari X-Grade
o.webkit=1;
}
// Modern WebKit browsers are at least X-Grade
if (m&&m[1]) {
// Mobile browser check
if (/ Mobile\//.test(ua)) {
} else {
if (m) {
}
}
}
if (!o.webkit) { // not webkit
if (m&&m[1]) {
if (m) {
}
} else { // not opera or webkit
if (m&&m[1]) {
} else { // not opera, webkit, or ie
if (m) {
if (m&&m[1]) {
}
}
}
}
}
return o;
}();
}, "@VERSION@");
// requires lang
var L = Y.Lang;
/**
* 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.
* @method later
* @param when {int} the number of milliseconds to wait until the fn
* is executed
* @param o the context object
* @param fn {Function|String} the function to execute or the name of
* the method in the 'o' object to execute
* @param data [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]
* @param periodic {boolean} if true, executes continuously at supplied
* interval until canceled
* @return a timer object. Call the cancel() method on this object to
* stop the timer.
*/
o = o || {};
m = o[fn];
}
if (!m) {
Y.fail("method undefined");
}
if (!L.isArray(d)) {
d = [data];
}
f = function() {
m.apply(o, d);
};
return {
cancel: function() {
if (this.interval) {
clearInterval(r);
} else {
clearTimeout(r);
}
}
};
};
}, "@VERSION@");
var BEFORE = 0,
AFTER = 1;
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
Y.Do = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
*/
objs: {},
/**
* Execute the supplied method before the specified function
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @static
*/
var f = fn;
if (c) {
}
},
/**
* Execute the supplied method after the specified function
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @static
*/
var f = fn;
if (c) {
}
},
/**
* Execute the supplied method after the specified function
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
// object id
// create a map entry for the obj if it doesn't exist
}
if (! o[sFn]) {
// create a map entry for the method if it doesn't exist
// re-route the method to our wrapper
function() {
};
}
// subscriber id
// register the callback
return sid;
},
/**
* Detach a before or after subscription
* @method detach
* @param sid {string} the subscription handle
*/
},
}
};
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
this.methodName = sFn;
// this.before = [];
// this.after = [];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
if (when) {
// this.after.push(fn);
} else {
// this.before.push(fn);
}
};
/**
* Execute the wrapped method
* @method exec
*/
// for (i=0; i<this.before.length; ++i) {
for (i in bf) {
if (bf.hasOwnProperty(i)) {
// Stop processing if an Error is returned
// Check for altered arguments
}
}
}
// execute method
// execute after methods.
// for (i=0; i<this.after.length; ++i) {
for (i in af) {
if (af.hasOwnProperty(i)) {
// Stop processing if an Error is returned
// Check for a new return value
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls
* @class Do.Error
*/
};
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. An example would be a service that scrubs
* out illegal characters prior to executing the core business logic.
* @class Do.AlterArgs
*/
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller
* @class Do.AlterReturn
*/
};
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
}, "3.0.0");
/**
* The YUI event system
* @module event
*/
var onsubscribeType = "_event:onsub",
AFTER = 'after',
CONFIGS = [
'bubbles',
'context',
'currentTarget',
'defaultFn',
'details',
'emitFacade',
'fireOnce',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
];
/**
* Return value from all subscribe operations
* @class Event.Handle
* @constructor
* @param evt {Event.Custom} the custom event
* @param sub {Event.Subscriber} the subscriber
*/
return null;
}
/**
* The custom event
* @type Event.Custom
*/
/**
* The subscriber object
* @type Event.Subscriber
*/
};
Y.EventHandle.prototype = {
/**
* Detaches this subscriber
* @method detach
*/
detach: function() {
}
};
/**
* The Event.Custom class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires
* @param {Object} context The context the event will fire from. "this" will
* refer to this object in the callback. Default value:
* the window object. The listener can override this.
* @param {boolean} silent pass true to prevent the event from writing to
* the debug system
* @class Event.Custom
* @constructor
*/
Y.CustomEvent = function(type, o) {
}
o = o || {};
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Event.Subscriber{}
*/
this.subscribers = {};
/**
* 'After' subscribers
* @property afters
* @type Event.Subscriber{}
*/
this.afters = {};
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
this.fired = false;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
this.fireOnce = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type Event.Target
*/
this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be canceled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
this.emitFacade = false;
this.applyConfig(o, true);
// Only add subscribe events for events that are not generated by
// Event.Custom
if (type !== onsubscribeType) {
/**
* Custom events provide a custom event that fires whenever there is
* a new subscriber to the event. This provides an opportunity to
* handle the case where there is a non-repeating event that has
* already fired has a new subscriber.
*
* @event subscribeEvent
* @type Y.Event.Custom
* @param {Function} fn The function to execute
* @param {Object} obj An object to be passed along when the event
* fires
* @param {boolean|Object} override If true, the obj passed in becomes
* the execution context of the listener.
* if an object, that object becomes the
* the execution context.
*/
context: this,
silent: true
});
}
};
Y.CustomEvent.prototype = {
_YUI_EVENT: true,
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
// Y.mix(this, o, force);
},
if (!fn) {
}
var se = this.subscribeEvent;
if (se) {
}
this._notify(s);
}
} else {
this.subscribers[s.id] = s;
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute
* @param {Object} obj An object to be passed along when the event fires
* @param args* 1..n params to provide to the listener
* @return {Event.Handle} unsubscribe handle
*/
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute
* @param {Object} obj An object to be passed along when the event fires
* @param args* 1..n params to provide to the listener
* @return {Event.Handle} unsubscribe handle
*/
},
/**
* Unsubscribes subscribers.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed
* @param {Object} obj The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {boolean} True if the subscriber was found and detached.
*/
// if arg[0] typeof unsubscribe handle
}
if (!fn) {
return this.unsubscribeAll();
}
for (var i in subs) {
var s = subs[i];
this._delete(s);
found = true;
}
}
}
return found;
},
_getFacade: function(args) {
if (!ef) {
}
// if the first argument is an object literal, apply the
// properties to the event facade
}
// update the details field with the arguments
return this._facade;
},
/**
* Notify a single subscriber
* @method _notify
* @param s {Event.Subscriber} the subscriber
* @param args {Array} the arguments array to apply to the listener
* @private
*/
var ret;
// emit an Event.Facade if this is that sort of event
// if (this.emitFacade && (!args[0] || !args[0]._yuifacade)) {
if (this.emitFacade) {
// @TODO object literal support to fire makes it possible for
// config info to be passed if we wish.
if (!ef) {
}
}
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param msg {string} message to log
* @param cat {string} log category
*/
// if (!s && !this.silent) {
if (!this.silent) {
}
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise
*/
fire: function() {
if (es) {
// var b = this.bubbles, h = this.host;
// if (b && h) {
// b = (h._yuievt.targets.length);
// }
// es.silent = (es.silent || this.silent);
// queue this event if the current item in the queue bubbles
// if (b && this.queuable && this.type != es.next.type) {
return true;
}
} else {
Y.Env._eventstack = {
// id of the first event in the stack
next: this,
stopped: 0,
prevented: 0,
queue: []
};
}
var ret = true;
} else {
// var subs = this.subscribers.slice(), len=subs.length,
this.stopped = 0;
this.prevented = 0;
this.fired = true;
var hasSub = false;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
if (!hasSub) {
hasSub = true;
}
// stopImmediatePropagation
if (this.stopped == 2) {
break;
}
s = subs[i];
if (s && s.fn) {
if (false === ret) {
this.stopped = 2;
}
}
}
}
// bubble if this is hosted in an event target and propagation has not been stopped
// @TODO check if we need to worry about defaultFn order
}
// execute the default behavior if not prevented
// @TODO need context
}
// process after listeners. If the default behavior was
// prevented, the after events don't fire.
for (i in subs) {
if (subs.hasOwnProperty(i)) {
if (!hasSub) {
hasSub = true;
}
// stopImmediatePropagation
if (this.stopped == 2) {
break;
}
s = subs[i];
if (s && s.fn) {
if (false === ret) {
this.stopped = 2;
}
}
}
}
}
}
// console.log('clearing stack: ' + es.id + ', ' + this);
// reset propragation properties while processing the rest of the queue
// process queued events
// q[0] = the event, q[1] = arguments to fire
// set up stack to allow the next item to be processed
}
Y.Env._eventstack = null;
}
return (ret !== false);
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed
*/
unsubscribeAll: function() {
var subs = this.subscribers, i;
for (i in subs) {
}
}
this.subscribers={};
return i;
},
/**
* @method _delete
* @param subscriber object
* @private
*/
_delete: function(s) {
if (s) {
delete s.fn;
delete s.obj;
delete this.subscribers[s.id];
}
},
/**
* @method toString
*/
toString: function() {
},
/**
* Stop propagation to bubble targets
* @method stopPropagation
*/
stopPropagation: function() {
this.stopped = 1;
if (this.stoppedFn) {
}
},
/**
* Stops propagation to bubble targets, and prevents any remaining
* subscribers on the current target from executing.
* @method stopImmediatePropagation
*/
stopImmediatePropagation: function() {
this.stopped = 2;
if (this.stoppedFn) {
}
},
preventDefault: function() {
if (this.preventable) {
this.prevented = 1;
}
if (this.preventedFn) {
}
}
};
/////////////////////////////////////////////////////////////////////
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute
* @param {Object} obj An object to be passed along when the event fires
* @param {Array} args subscribe() additional arguments
*
* @class Event.Subscriber
* @constructor
*/
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.bind if obj was supplied.
* @property fn
* @type Function
*/
/**
* An optional custom object that will passed to the callback when
* the event fires
* @property obj
* @type Object
*/
/**
* Unique subscriber id
* @property id
* @type String
*/
/**
* Optional additional arguments supplied to subscribe(). If present,
* these will be appended to the arguments supplied to fire()
* @property args
* @type Array
*/
// this.args = args;
var m = fn;
if (obj) {
}
/**
* }
* fn bound to obj with additional arguments applied via Y.bind
* @property wrappedFn
* @type Function
*/
this.wrappedFn = m;
};
Y.Subscriber.prototype = {
/**
* Executes the subscriber.
* @method notify
* @param defaultContext The execution context if not overridden
* by the subscriber
* @param args {Array} Arguments array for the subscriber
*/
try {
} catch(e) {
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute
* @param {Object} obj an object to be passed along when the event fires
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
if (obj) {
} else {
}
},
/**
* @method toString
*/
toString: function() {
return "Subscriber " + this.id;
}
};
}, "3.0.0");
var SILENT = { 'yui:log': true };
/**
* Event.Target is designed to be used with Y.augment to wrap
* Event.Custom in an interface that allows events to be subscribed to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
*
* @Class Event.Target
*/
Y.EventTarget = function(opts) {
// console.log('Event.Target constructor executed: ' + this._yuid);
this._yuievt = {
events: {},
targets: {},
config: o,
defaults: {
context: this,
host: this,
emitFacade: o.emitFacade || false,
}
};
};
var ET = Y.EventTarget;
/**
* Subscribe to a custom event hosted by this object
* @method subscribe
* @param type {string} The type of the event
* @param fn {Function} The callback
* @param context The execution context
* @param args* 1..n params to supply to the callback
*/
a = Y.Array(arguments, 1, true);
},
/**
* Unsubscribes one or more listeners the from the specified event
* @method unsubscribe
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {boolean} true if the subscriber was found and detached.
*/
// If this is an event handle, use it to detach
}
if (type) {
if (ce) {
}
} else {
var ret = true;
for (var i in evts) {
}
}
return ret;
}
return false;
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {string} The type, or name of the event
*/
unsubscribeAll: function(type) {
return this.unsubscribe(type);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {string} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* context: defines the default execution context. If not defined
* the default context will be this instance.
* </li>
* <li>
* silent: if true, the custom event will not generate log messages.
* This is false by default.
* </li>
* <li>
* onSubscribeCallback: specifies a callback to execute when the
* event has a new subscriber. This will fire immediately for
* each queued subscriber if any exist prior to the creation of
* the event.
* </li>
* </ul>
*
* @return {Event.Custom} the custom event
*
*/
if (ce) {
// update config for the event
ce.applyConfig(o, true);
} else {
// apply defaults
if (o.onSubscribeCallback) {
}
}
},
/**
* Registers another Event.Target as a bubble target. Bubble order
* is determined by the order registered. Multiple targets can
* be specified.
* @method addTarget
* @param o {Event.Target} the target to add
*/
addTarget: function(o) {
},
/**
* Removes a bubble target
* @method removeTarget
* @param o {Event.Target} the target to remove
*/
removeTarget: function(o) {
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} the return value from Event.Custom.fire
*
*/
if (!ce) {
// if (!(type in SILENT)) {
// }
return true;
}
// Provide this object's subscribers the object they are listening to.
// ce.currentTarget = this;
// This this the target unless target is current not null
// (set in bubble()).
// ce.target = ce.target || this;
// clear target for next fire()
return ret;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {string} the type, or name of the event
* @return {Event.Target} the custom event or a falsy value
*/
return (e && e[type]);
},
/**
* Propagate an event
* @method bubble
* @param evt {Event.Custom} the custom event to propagate
* @return {boolean} the aggregated return value from Event.Custom.fire
*/
for (var i in targs) {
if (targs.hasOwnProperty(i)) {
// if this event was not published on the bubble target,
// publish it with sensible default properties
if (!ce) {
// publish the event on the bubble target using this event
// for its configuration
// set the host and context appropriately
// clear handlers if specified on this event
ce.preventedFn = null;
}
ce.currentTarget = t;
// ce.target = evt.target;
// stopPropagation() was called
break;
}
}
}
}
return ret;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
* @method after
* @param type {string} The type of the event
* @param fn {Function} The callback
* @param context The execution context
* @param args* 1..n params to supply to the callback
*/
a = Y.Array(arguments, 1, true);
}
};
// make Y an event target
bubbles: false
});
}, "3.0.0");
if (Y === YUI) {
return;
}
// Fire the content ready custom event
// E.DOMReadyEvent.fire();
if (D.removeEventListener) {
}
}
};
// create custom event
/////////////////////////////////////////////////////////////
// DOMReady
// Internet Explorer: use the readyState of a defered script.
// This isolates what appears to be a safe moment to manipulate
// the DOM prior to when the document's readyState suggests
// it is safe to do so.
var n = D.createElement('p');
try {
// throws an error if doc is not ready
n.doScroll('left');
n = null;
} catch (ex) {
n = null;
}
}, POLL_INTERVAL);
// The document's readyState in Safari currently will
var rs=D.readyState;
}
}, POLL_INTERVAL);
// FireFox and Opera: These browsers provide a event for this
// moment. The latest WebKit releases now support this event.
} else {
}
/////////////////////////////////////////////////////////////
}
Y.publish('event:ready', {
fireOnce: true
});
var yready = function() {
Y.fire('event:ready');
};
yready();
} else {
}
}, "3.0.0");
/*
* The Event Utility provides utilities for managing DOM Events and tools
* for building event systems
*
* @module event
* @title Event Utility
*/
/**
* The event utility provides functions to add and remove event listeners,
* event cleansing. It also tries to automatically remove listeners it
* registers during the unload event.
*
* @class Event
* @static
*/
Y.Event = function() {
/**
* True after the onload event has fired
* @property loadComplete
* @type boolean
* @static
* @private
*/
var loadComplete = false;
/**
* The number of times to poll after window.onload. This number is
* increased if additional late-bound handlers are requested after
* the page load.
* @property _retryCount
* @static
* @private
*/
var _retryCount = 0;
/**
* onAvailable listeners
* @property _avail
* @static
* @private
*/
var _avail = [];
/**
* Custom event wrappers for DOM events. Key is
* 'event:' + Element uid stamp + event type
* @property _wrappers
* @type Y.Event.Custom
* @static
* @private
*/
var _wrappers = {};
/**
* Custom event wrapper map DOM events. Key is
* Element uid stamp. Each item is a hash of custom event
* wrappers as provided in the _wrappers collection. This
* provides the infrastructure for getListeners.
* @property _el_events
* @static
* @private
*/
var _el_events = {};
return {
/**
* The number of times we should look for elements that are not
* in the DOM at the time the event is requested after the document
* has been loaded. The default is 2000@amp;20 ms, so it will poll
* for 40 seconds or until all outstanding handlers are bound
* (whichever comes first).
* @property POLL_RETRYS
* @type int
* @static
* @final
*/
POLL_RETRYS: 2000,
/**
* The poll interval in milliseconds
* @property POLL_INTERVAL
* @type int
* @static
* @final
*/
POLL_INTERVAL: 20,
/**
* addListener/removeListener can throw errors in unexpected scenarios.
* These errors are suppressed, the method returns false, and this property
* is set
* @property lastError
* @static
* @type Error
*/
lastError: null,
/**
* poll handle
* @property _interval
* @static
* @private
*/
_interval: null,
/**
* document readystate poll handle
* @property _dri
* @static
* @private
*/
_dri: null,
/**
* True when the document is initially usable
* @property DOMReady
* @type boolean
* @static
*/
DOMReady: false,
/**
* @method startInterval
* @static
* @private
*/
startInterval: function() {
if (!this._interval) {
var self = this;
}
},
/**
* Executes the supplied callback when the item with the supplied
* id is found. This is meant to be used to execute behavior as
* soon as possible as the page loads. If you use this after the
* initial page load it will poll for a fixed time for the element.
* The number of times it will poll and the frequency are
* configurable. By default it will poll for 10 seconds.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onAvailable
*
* @param {string||string[]} id the id of the element, or an array
* of ids to look for.
* @param {function} fn what to execute when the element is found.
* @param {object} p_obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} p_override If set to true, fn will execute
* in the context of p_obj, if set to an object it
* will execute in the context of that object
* @param checkContent {boolean} check child node readiness (onContentReady)
* @static
*/
// @TODO fix arguments
// var a = (Y.Lang.isString(id)) ? [id] : id;
var a = Y.Array(id);
checkReady: checkContent });
}
_retryCount = this.POLL_RETRYS;
this.startInterval();
},
/**
* Works the same way as onAvailable, but additionally checks the
* state of sibling elements to determine if the content of the
* available element is safe to modify.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onContentReady
*
* @param {string} id the id of the element to look for.
* @param {function} fn what to execute when the element is ready.
* @param {object} p_obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} p_override If set to true, fn will execute
* in the context of p_obj. If an object, fn will
* exectute in the context of that object
*
* @static
*/
// @TODO fix arguments
},
/**
* Executes the supplied callback when the DOM is first usable. This
* will execute immediately if called after the DOMReady event has
* fired. @todo the DOMContentReady event does not fire when the
* script is dynamically injected into the page. This means the
* DOMReady custom event will never fire in FireFox or Opera when the
* library is injected. It _will_ fire in Safari, and the IE
* implementation would allow for us to fire it if the defered script
* is not available. We want this to behave the same in all browsers.
* Is there a way to identify when the script has been injected
* instead of included inline? Is there a way to know whether the
* window onload event has fired without having had a listener attached
* to it when it did so?
*
* <p>The callback is a Event.Custom, so the signature is:</p>
* <p>type <string>, args <array>, customobject <object></p>
* <p>For DOMReady events, there are no fire argments, so the
* signature is:</p>
* <p>"DOMReady", [], obj</p>
*
*
* @method onDOMReady
*
* @param {function} fn what to execute when the element is found.
* @optional context execution context
* @optional args 1..n arguments to send to the listener
*
* @static
*/
onDOMReady: function(fn) {
// var ev = Y.Event.DOMReadyEvent;
// ev.subscribe.apply(ev, arguments);
var a = Y.Array(arguments, 0, true);
a.unshift('event:ready');
},
/**
* Appends an event handler
*
* @method addListener
*
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* listener to.
* @param {String} type The type of event to append
* @param {Function} fn The method the event invokes
* @param {Object} obj An arbitrary object that will be
* passed as a parameter to the handler
* @param {Boolean|object} args 1..n ar
* @return {Boolean} True if the action was successful or defered,
* false if one or more of the elements
* could not have the listener attached,
* or if the operation throws an exception.
* @static
*/
// throw new TypeError(type + " addListener call failed, callback undefined");
return false;
}
// The el argument can be an array of elements or element ids.
if (this._isValidCollection(el)) {
// handles.push(this.addListener(el[i], type, fn, obj, override));
// var node = el.item(k);
var b = a.slice();
b.unshift(v);
h = E.addListener.apply(E, b);
};
return handles;
// If the el argument is a string, we assume it is
// actually the id of the element. If the page is loaded
// we convert el to the actual element, otherwise we
// defer attaching the event until onload event fires
// check to see if we need to delay hooking up the event
// until after the page loads.
if (oEl) {
} else {
}
} else {
//
// defer adding the event until the element is available
this.onAvailable(el, function() {
// Y.Event.addListener(el, type, fn, obj, override);
});
return true;
}
}
// Element should be an html element or an array if we get
// here.
if (!el) {
return false;
}
// the custom event key is the uid for the element + type
if (!cewrapper) {
// create CE wrapper
silent: true,
// host: this,
bubbles: false
});
// cache the dom event details in the custom event
// for later removeListener calls
};
// var capture = (Y.lang.isObject(obj) && obj.capture);
// attach a listener that fires the custom event
}
// from type, fn, etc to fn, obj, override
a = Y.Array(arguments, 2, true);
// a = a.shift();
// if (override) {
// if (override === true) {
// context = obj;
// } else {
// context = override;
// }
// }
a[1] = context;
// set context to element if not specified
},
/**
* Removes an event listener
*
* @method removeListener
*
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* the listener from.
* @param {String} type the type of event to remove.
* @param {Function} fn the method the event invokes. If fn is
* undefined, then all event handlers for the type of event are * removed.
* @return {boolean} true if the unbind was successful, false * otherwise.
* @static
*/
}
// The el argument can be a string
if (typeof el == "string") {
// The el argument can be an array of elements or element ids.
} else if ( this._isValidCollection(el)) {
var ok = true;
}
return ok;
}
//return false;
}
if (ce) {
}
},
/**
* Finds the event in the window object, the caller's arguments, or
* in the arguments of another method in the callstack. This is
* executed automatically for events registered through the event
* manager, so the implementer should not normally need to execute
* this function at all.
* @method getEvent
* @param {Event} e the event parameter from the handler
* @param {HTMLElement} boundEl the element the listener is attached to
* @return {Event} the event
* @static
*/
if (!ev) {
while (c) {
break;
}
c = c.caller;
}
}
},
/**
* Generates an unique ID for the element if it does not already
* have one.
* @method generateId
* @param el the element to create the id for
* @return {string} the resulting id of the element
* @static
*/
generateId: function(el) {
if (!id) {
}
return id;
},
/**
* We want to be able to use getElementsByTagName as a collection
* to attach a group of events to. Unfortunately, different
* browsers return different types of collections. This function
* tests to determine if the object is array-like. It will also
* fail if the object is an array, but is empty.
* @method _isValidCollection
* @param o the object to test
* @return {boolean} true if the object is array-like and populated
* @static
* @private
*/
_isValidCollection: function(o) {
try {
return ( o && // o is something
typeof o !== "string" && // o is not a string
!o.tagName && // o is not an HTML element
!o.alert && // o is not a window
} catch(ex) {
return false;
}
},
/*
* Custom event the fires when the dom is initially usable
* @event DOMReadyEvent
*/
// DOMReadyEvent: new Y.CustomEvent("event:ready", this),
// DOMReadyEvent: Y.publish("event:ready", this, {
// fireOnce: true
// }),
/**
* hook up any deferred listeners
* @method _load
* @static
* @private
*/
_load: function(e) {
if (!loadComplete) {
loadComplete = true;
var E = Y.Event;
// Just in case DOMReady did not go off for some reason
// E._ready();
// Available elements may not have been detected before the
// window load event fires. Try to find them now so that the
// the user is more likely to get the onAvailable notifications
// before the window load notification
E._tryPreloadAttach();
}
},
/**
* Polling function that runs before the onload event fires,
* attempting to attach to DOM Nodes as soon as they are
* available
* @method _tryPreloadAttach
* @static
* @private
*/
_tryPreloadAttach: function() {
if (this.locked) {
return;
}
// Hold off if DOMReady has not fired and check current
// readyState to protect against the IE operation aborted
// issue.
if (!this.DOMReady) {
this.startInterval();
return;
}
}
this.locked = true;
// keep trying until after the page is loaded. We need to
// check the page load state prior to trying to bind the
// elements so that we can be certain all elements have been
// tested appropriately
var tryAgain = !loadComplete;
if (!tryAgain) {
}
// onAvailable
var notAvail = [];
} else {
}
}
};
// onAvailable
if (el) {
_avail[i] = null;
} else {
}
}
}
// onContentReady
if (el) {
// The element is available, but not necessarily ready
// @todo should we test parentNode.nextSibling?
_avail[i] = null;
}
} else {
}
}
}
if (tryAgain) {
// we may need to strip the nulled out items here
this.startInterval();
} else {
clearInterval(this._interval);
this._interval = null;
}
this.locked = false;
return;
},
/**
* Removes all listeners attached to the given element via addListener.
* Optionally, the node's children can also be purged.
* Optionally, you can specify a specific type of event to remove.
* @method purgeElement
* @param {HTMLElement} el the element to purge
* @param {boolean} recurse recursively purge this element's children
* as well. Use with caution.
* @param {string} type optional type of listener to purge. If
* left out, all listeners will be removed
* @static
*/
if (lis) {
lis[i].unsubscribeAll();
}
}
}
}
},
/**
* Returns all listeners attached to the given element via addListener.
* Optionally, you can specify a specific type of event to return.
* @method getListeners
* @param el {HTMLElement|string} the element or element id to inspect
* @param type {string} optional type of listener to return. If
* left out, all listeners will be returned
* @return {Y.Custom.Event} the custom event wrapper for the DOM event(s)
* @static
*/
if (key) {
}
} else {
for (var i in evts) {
}
}
},
/**
* Removes all listeners registered by pe.event. Called
* automatically during the unload event.
* @method _unload
* @static
* @private
*/
_unload: function(e) {
var E = Y.Event, i, w;
for (i in _wrappers) {
w = _wrappers[i];
w.unsubscribeAll();
delete _wrappers[i];
}
},
/**
* Adds a DOM event directly without the caching, cleanup, context adj, etc
*
* @method nativeAdd
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
if (el.addEventListener) {
} else if (el.attachEvent) {
}
// else {
// }
},
/**
* Basic remove listener
*
* @method nativeRemove
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
if (el.removeEventListener) {
} else if (el.detachEvent) {
}
}
};
}();
var E = Y.Event;
// Process onAvailable/onContentReady items when when the DOM is ready in IE
}
E.Custom = Y.CustomEvent;
E.Subscriber = Y.Subscriber;
E.Target = Y.EventTarget;
/**
* Y.Event.on is an alias for addListener
* @method on
* @see addListener
* @static
*/
var a = Y.Array(arguments, 0, true),
return E.addListener.apply(E, a);
};
};
E._tryPreloadAttach();
}, "3.0.0");
var whitelist = {
"altKey" : 1,
// "button" : 1, // we supply
// "bubbles" : 1, // needed?
// "cancelable" : 1, // needed?
// "charCode" : 1, // we supply
"cancelBubble" : 1,
// "currentTarget" : 1, // we supply
"ctrlKey" : 1,
"clientX" : 1, // needed?
"clientY" : 1, // needed?
"detail" : 1, // not fully implemented
// "fromElement" : 1,
"keyCode" : 1,
// "height" : 1, // needed?
// "initEvent" : 1, // need the init events?
// "initMouseEvent" : 1,
// "initUIEvent" : 1,
// "layerX" : 1, // needed?
// "layerY" : 1, // needed?
"metaKey" : 1,
// "modifiers" : 1, // needed?
// "offsetX" : 1, // needed?
// "offsetY" : 1, // needed?
// "preventDefault" : 1, // we supply
// "reason" : 1, // IE proprietary
// "relatedTarget" : 1,
// "returnValue" : 1, // needed?
"shiftKey" : 1,
// "srcUrn" : 1, // IE proprietary
// "srcElement" : 1,
// "srcFilter" : 1, IE proprietary
// "stopPropagation" : 1, // we supply
// "target" : 1,
// "timeStamp" : 1, // needed?
// "toElement" : 1,
"type" : 1,
// "view" : 1,
// "which" : 1, // we supply
// "width" : 1, // needed?
"x" : 1,
"y" : 1
};
/**
* webkit key remapping required for Safari < 3.1
* @property webkitKeymap
* @private
*/
webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
63235: 39, // right
63276: 33, // page up
63277: 34, // page down
25: 9 // SHIFT-TAB (Safari provides a different key code in
// this case, even though the shiftKey modifier is set)
},
/**
* Returns a wrapped node. Intended to be used on event targets,
* so it will return the node's parent if the target is a text
* node
* @method resolve
* @private
*/
resolve = function(n) {
if (!n) {
return null;
}
try {
n = n.parentNode;
}
} catch(ex) { }
};
// provide a single event with browser abstractions resolved
//
// include all properties for both browers?
// include only DOM2 spec properties?
// provide browser-specific facade?
/**
* Wraps a DOM event, properties requiring browser abstraction are
* fixed here. Provids a security layer when required.
* @class Event.Facade
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {Event.Custom} the custom event wrapper for this DOM event
*/
// @TODO the document should be the target's owner document
// copy all primitives ... this is slow in FF
// for (var i in e) {
for (var i in whitelist) {
// if (!Y.Lang.isObject(e[i])) {
if (whitelist.hasOwnProperty(i)) {
this[i] = e[i];
}
}
//////////////////////////////////////////////////////
if (!x && 0 !== x) {
x = e.clientX || 0;
y = e.clientY || 0;
}
}
this._yuifacade = true;
/**
* The X location of the event on the page (including scroll)
* @property pageX
* @type int
*/
this.pageX = x;
/**
* The Y location of the event on the page (including scroll)
* @property pageY
* @type int
*/
this.pageY = y;
//////////////////////////////////////////////////////
/**
* The keyCode for key events. Uses charCode if keyCode is not available
* @property keyCode
* @type int
*/
c = webkitKeymap[c];
}
/**
* The keyCode for key events. Uses charCode if keyCode is not available
* @property keyCode
* @type int
*/
this.keyCode = c;
/**
* The charCode for key events. Same as keyCode
* @property charCode
* @type int
*/
this.charCode = c;
//////////////////////////////////////////////////////
/**
* The button that was pushed.
* @property button
* @type int
*/
/**
* The button that was pushed. Same as button.
* @property which
* @type int
*/
/**
* The event details. Currently supported for Custom
* Events only, where it contains the arguments that
* were passed to fire().
* @property details
* @type Array
*/
//////////////////////////////////////////////////////
/**
* Timestamp for the event
* @property time
* @type Date
*/
//////////////////////////////////////////////////////
/**
* Node reference for the targeted element
* @propery target
* @type Node
*/
/**
* Node reference for the element that the listener was attached to.
* @propery currentTarget
* @type Node
*/
var t = e.relatedTarget;
if (!t) {
if (e.type == "mouseout") {
t = e.toElement;
} else if (e.type == "mouseover") {
t = e.fromElement;
}
}
/**
* Node reference to the relatedTarget
* @propery relatedTarget
* @type Node
*/
//////////////////////////////////////////////////////
// methods
/**
* Stops the propagation to the next bubble target
* @method stopPropagation
*/
this.stopPropagation = function() {
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
if (wrapper) {
}
};
/**
* Stops the propagation to the next bubble target and
* prevents any additional listeners from being exectued
* on the current target.
* @method stopImmediatePropagation
*/
this.stopImmediatePropagation = function() {
if (e.stopImmediatePropagation) {
} else {
this.stopPropagation();
}
if (wrapper) {
}
};
/**
* Prevents the event's default behavior
* @method preventDefault
*/
this.preventDefault = function() {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
if (wrapper) {
}
};
/**
* Stops the event propagation and prevents the default
* event behavior.
* @method halt
* @param immediate {boolean} if true additional listeners
* on the current target will not be executed
*/
if (immediate) {
this.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this.preventDefault();
};
};
}, "3.0.0");
/**
* Provides a wrapper for dom nodes that supports selector queries normalizes x-browser differences.
* @module node
*/
/**
* A wrapper for DOM Nodes.
* With the exception of the noted properties,
* only strings, numbers, and booleans are passed through.
* Use Y.get() or Y.Node.get() to retrieve Node instances.
*
* @class Node
*/
var BASE_NODE = 0,
ELEMENT_NODE = 1,
ATTRIBUTE_NODE = 2,
TEXT_NODE = 3,
CDATA_SECTION_NODE = 4,
ENTITY_NODE = 6,
COMMENT_NODE = 8,
DOCUMENT_NODE = 9,
DOCUMENT_TYPE_NODE = 10,
DOCUMENT_FRAGMENT_NODE = 11,
NOTATION_NODE = 12;
var OWNER_DOCUMENT = 'ownerDocument',
DEFAULT_VIEW = 'defaultView',
PARENT_WINDOW = 'parentWindow',
DOCUMENT_ELEMENT = 'documentElement',
NODE_NAME = 'nodeName',
NODE_TYPE = 'nodeType',
COMPAT_MODE = 'compatMode',
PARENT_NODE = 'parentNode',
PREVIOUS_SIBLING = 'previousSibling',
NEXT_SIBLING = 'nextSibling',
SCROLL_TOP = 'scrollTop',
SCROLL_LEFT = 'scrollLeft',
COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition',
CONTAINS = 'contains';
var _instances = {};
var _nodes = {};
var _styles = {};
var _restrict = null;
// private factory
var ret = null;
/*
var instance = _instances[node.id];
if (instance) {
if (node === _nodes[instance._yuid]) {
ret = instance; // reuse existing Nodes if nodes match
}
}
*/
}
return ret;
};
if (fn) {
return function() {
}();
}
};
};
// returns HTMLElement
var getDOMNode = function(node) {
}
return node || null;
};
/**
* Wraps the input and outputs of a node instance
*/
if (a) { // first 2 may be Node instances or nodes (TODO: or strings?)
a = getDOMNode(a);
if (b) {
b = getDOMNode(b);
}
}
};
/*
* Wraps the return value in a node instance
*/
};
/*
* Returns directy from node method call
*/
};
return this;
};
var PROPS_WRAP = {
/**
* Returns a Node instance.
* @attribute parentNode
* @type Node
*/
'parentNode': BASE_NODE,
/**
* Returns a NodeList instance.
* @attribute childNodes
* @type NodeList
*/
'childNodes': BASE_NODE,
/**
* Returns a NodeList instance.
* @attribute children
* @type NodeList
*/
'children': function(node) {
children = [];
if (childNodes[i].tagName) {
}
}
}
return children;
},
/**
* Returns a Node instance.
* @attribute firstChild
* @type Node
*/
'firstChild': BASE_NODE,
/**
* Returns a Node instance.
* @attribute lastChild
* @type Node
*/
'lastChild': BASE_NODE,
/**
* Returns a Node instance.
* @attribute previousSibling
* @type Node
*/
'previousSibling': BASE_NODE,
/**
* Returns a Node instance.
* @attribute previousSibling
* @type Node
*/
'nextSibling': BASE_NODE,
/**
* Returns a Node instance.
* @attribute ownerDocument
* @type Doc
*/
'ownerDocument': BASE_NODE,
/**
* Returns a Node instance.
* @attribute offsetParent
* @type Node
*/
'offsetParent': ELEMENT_NODE,
/**
* Returns a Node instance.
* @attribute documentElement
* @type Node
*/
'documentElement': DOCUMENT_NODE,
/**
* Returns a Node instance.
* @attribute body
* @type Node
*/
'body': DOCUMENT_NODE,
// form
/**
* Returns a NodeList instance.
* @attribute elements
* @type NodeList
*/
'elements': ELEMENT_NODE,
/**
* Returns a NodeList instance.
* @attribute options
* @type NodeList
*/
'options': ELEMENT_NODE,
// table
/**
* Returns a NodeList instance.
* @attribute rows
* @type NodeList
*/
'rows': ELEMENT_NODE,
/**
* Returns a NodeList instance.
* @attribute cells
* @type NodeList
*/
'cells': ELEMENT_NODE,
/**
* Returns a Node instance.
* @attribute tHead
* @type Node
*/
'tHead': ELEMENT_NODE,
/**
* Returns a Node instance.
* @attribute tFoot
* @type Node
*/
'tFoot': ELEMENT_NODE,
/**
* Returns a NodeList instance.
* @attribute tBodies
* @type NodeList
*/
'tBodies': ELEMENT_NODE
};
var METHODS = {
/**
* Passes through to DOM method.
* @method replaceChild
* @param {String | HTMLElement | Node} node Node to be inserted
* @param {String | HTMLElement | Node} refNode Node to be replaced
* @return {Node} The replaced node
*/
/**
* Passes through to DOM method.
* @method removeChild
* @param {String | HTMLElement | Node} node Node to be removed
* @return {Node} The removed node
*/
/**
* Passes through to DOM method.
* @method appendChild
* @param {String | HTMLElement | Node} node Node to be appended
* @return {Node} The appended node
*/
/**
* Passes through to DOM method.
* @method hasChildNodes
* @return {Boolean} Whether or not the node has any childNodes
*/
/**
* Passes through to DOM method.
* @method cloneNode
* @param {String | HTMLElement | Node} node Node to be cloned
* @return {Node} The clone
*/
/**
* Passes through to DOM method.
* @method getAttribute
* @param {String} attribute The attribute to retrieve
* @return {String} The current value of the attribute
*/
/**
* Passes through to DOM method.
* @method setAttribute
* @param {String} attribute The attribute to set
* @param {String} The value to apply to the attribute
*/
/**
* Passes through to DOM method.
* @method hasAttribute
* @param {String} attribute The attribute to test for
* @return {Boolean} Whether or not the attribute is present
*/
/**
* Passes through to DOM method.
* @method scrollIntoView
*/
/**
* Passes through to DOM method.
* @method getElementsByTagName
* @param {String} tagName The tagName to collect
* @return {NodeList} A NodeList representing the HTMLCollection
*/
/**
* Passes through to DOM method.
* @method focus
*/
/**
* Passes through to DOM method.
* @method blur
*/
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method submit
*/
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method reset
*/
};
var METHODS_INVOKE = {
'getBoundingClientRect': true
};
return null;
}
/*
if (!node.id) {
node.id = Y.guid();
}
*/
//_instances[node.id] = this;
};
var SETTERS = {};
var GETTERS = {
/**
* Normalizes nodeInnerText and textContent.
* @property text
* @type String
*/
'text': function(node) {
}
};
if (typeof prop == 'string') {
} else { // assume object
});
}
};
if (typeof prop == 'string') {
} else { // assume object
});
}
};
if (typeof name == 'string') {
ret = this;
}
return ret;
};
} else { // assume object
});
}
};
var addNodeListMethod = function(name) {
var a = [],
ret;
a[i] = ret;
}
}
return a.length ? a : this;
};
};
var ret;
} else if (typeof node === 'string') {
} else {
}
return ret || null;
};
return function() {
};
};
var add = {};
});
};
/**
* @method set
* @param {String} prop Property to set
* @param {any} val Value to apply to the given property
*/
}
return this;
},
/**
* @method get
* @param {String} prop Property to get
* @return {any} Current value of the property
*/
var val;
} else {
}
val = null; // not allowed to go outside of root node
} else {
}
}
return val;
},
if (a) { // first 2 may be Node instances or strings
a = (a[NODE_TYPE]) ? a : getDOMNode(a);
if (b) {
b = (b[NODE_TYPE]) ? b : getDOMNode(b);
}
}
}
return null;
},
},
//normalize: function() {},
//isSupported: function(feature, version) {},
toString: function() {
},
/**
* Retrieves a single node based on the given CSS selector.
* @method query
*
* @param {string} selector The CSS selector to test against.
* @return {Node} A Node instance for the matching HTMLElement.
*/
},
/**
* Retrieves a nodeList based on the given CSS selector.
* @method queryAll
*
* @param {string} selector The CSS selector to test against.
* @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
*/
},
/**
* Test if the supplied node matches the supplied selector.
* @method test
*
* @param {string} selector The CSS selector to test against.
* @return {boolean} Whether or not the node matches the selector.
*/
},
/**
* Retrieves a style attribute from the given node.
* @method getStyle
* @param {String} attr The style attribute to retrieve.
* @return {String} The current value of the style property for the element.
*/
},
/**
* Retrieves the computed value for the given style attribute.
* @method getComputedStyle
* @param {String} attr The style attribute to retrieve.
* @return {String} The computed value of the style property for the element.
*/
getComputedStyle: function(attr) {
},
/**
* Applies a CSS style to a given node.
* @method setStyle
* @param {String} attr The style attribute to set.
* @param {String|Number} val The value.
*/
return this;
},
/**
* Sets multiple style properties.
* @method setStyles
* @param {Object} hash An object literal of property:value pairs.
*/
this.setStyle(n, v);
}, this);
return this;
},
/**
* Compares nodes to determine if they match.
* Node instances can be compared to each other and/or HTMLElements/selectors.
* @method compareTo
* @param {String | HTMLElement | Node} refNode The reference node to compare to the node.
* @return {Boolean} True if the nodes match, false if they do not.
*/
},
/*
* Returns the nearest ancestor that passes the test applied by supplied boolean method.
* @method ancestor
* @param {Function} fn - A boolean method for testing elements which receives the element as its only argument.
* @return {Node} The matching Node instance or null if not found
*/
},
/**
* Returns the previous sibling that is an HTMLElement.
* Returns the nearest HTMLElement sibling if no method provided.
* @method previous
* @param {Function} fn A boolean function used to test siblings
* that receives the sibling node being tested as its only argument.
* @param {Boolean} all optional Whether all node types should be returned, or just element nodes.
* @return {Node} Node instance or null if not found
*/
},
/**
* Returns the next sibling that passes the boolean method.
* Returns the nearest HTMLElement sibling if no method provided.
* @method next
* @param {Function} fn A boolean function used to test siblings
* that receives the sibling node being tested as its only argument.
* @param {Boolean} all optional Whether all node types should be returned, or just element nodes.
* @return {Object} HTMLElement or null if not found
*/
},
/**
* @method insertBefore
* @param {String | HTMLElement} node The node to insert
* @param {String | HTMLElement} refNode The node to insert the new node before
* @return {Node} The node that was inserted (or null if insert fails)
*/
if (typeof node === 'string') {
}
},
/**
* @method insertAfter
* @param {String | HTMLElement} node The node to insert
* @param {String | HTMLElement} refNode The node to insert the new node before
* @return {Node} The node that was inserted (or null if insert fails)
*/
if (typeof node === 'string') {
}
},
/**
* Attaches a DOM event handler.
* @method attach
* @param {String} type The type of DOM Event to listen for
* @param {Function} fn The handler to call when the event fires
* @param {Object} arg An argument object to pass to the handler
*/
},
/**
* Alias for attach.
* @method on
* @param {String} type The type of DOM Event to listen for
* @param {Function} fn The handler to call when the event fires
* @param {Object} arg An argument object to pass to the handler
* @see attach
*/
},
},
/**
* Detaches a DOM event handler.
* @method detach
* @param {String} type The type of DOM Event
* @param {Function} fn The handler to call when the event fires
*/
},
},
/**
* Creates a Node instance from HTML string
* @method create
* @param {String|Array} html The string of html to create
* @return {Node} A new Node instance
*/
},
/**
* Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
* @method contains
* @param {String | HTMLElement} needle The possible descendent
* @return {Boolean} Whether or not this node is an ancestor of needle
*/
},
}
return this;
},
/**
* Determines whether an HTMLElement is attached to a document.
* @method inDoc
* @param {Node|HTMLElement} doc optional An optional document to check against.
* Defaults to current document.
* @return {Boolean} Whether or not this node is attached to the document.
*/
if (doc.documentElement) {
}
}
};
};
});
var _createNode = function(data) {
return frag.firstChild;
};
/**
* Creates a Node instance from an HTML string
* @method create
* @param {String | Array} html HTML string
*/
//return wrapDOM(_createNode(html));
};
/**
* Returns a node instance wrapping the DOM element with the given ID.
* @method getById
* @static
* @param {String} id The ID to retrieve
* @param {Node|HTMLElement} doc optional An optional document to search.
* Defaults to current document.
*/
};
/**
* Note: Use 'document' string to retrieve document Node instance from string
* @method get
* @static
* @param {document|HTMLElement|HTMLCollection|Array|String} node The object to wrap.
* @param {document|Node} doc optional The document containing the node. Defaults to current document.
* @param {boolean} isRoot optional Whether or not this node should be treated as a root node. Root nodes
* aren't allowed to traverse outside their DOM tree.
* @return {Node} A wrapper instance for the supplied object.
*/
return node;
}
if (!doc) {
}
switch(node) {
case 'document':
break;
default:
}
}
if (isRoot) {
}
return node;
};
/**
* @method all
* @static
* @param {HTMLCollection|Array|String} node The object to wrap.
* @param {document|Node} doc optional The document containing the node. Defaults to current document.
* @return {NodeList} A wrapper instance for the supplied nodes.
*/
return nodes;
}
if (!doc) {
}
}
};
/**
* A wrapper for manipulating multiple DOM elements
* @class NodeList
*/
// TODO: input validation
};
// used to call Node methods against NodeList nodes
};
}
});
/**
* Retrieves the Node instance at the given index.
* @method item
*
* @param {Number} index The index of the target Node.
* @return {Node} The Node instance at the given index.
*/
},
/**
* @method set
* @param {String} prop Property to set
* @param {any} val Value to apply to the given property
* @see Node
*/
}
return this;
},
/**
* @method get
* @param {String} prop Property to get
* @return {Array} Array containing the current values mapped to the Node indexes
* @see Node
*/
if (name == 'length') {
}
var ret = [];
}
return ret;
},
/**
* Filters the NodeList instance down to only nodes matching the given selector.
* @method filter
* @param {String} selector The selector to filter against
* @return {NodeList} NodeList containing the updated collection
* @see Selector
*/
},
/**
* Applies the given function to each Node in the NodeList.
* @method each
* @param {Function} fn The function to apply
* @param {Object} context optional An optional context to apply the function with
* Default context is the NodeList instance
* @return {NodeList} NodeList containing the updated collection
* @see Y.each
*/
var node;
}
return this;
},
/**
* Returns the current number of items in the NodeList.
* @method size
* @return {Int} The number of items in the NodeList.
*/
size: function() {
},
toString: function() {
}
}, true);
/**
* Extended Node interface for managing classNames.
* @module node-class
*/
/**
* An interface for manipulating className strings.
* @interface NodeClassName
*/
Y.Node.addDOMMethods([
/**
* Determines whether an HTMLElement has the given className.
* @method hasClass
* @param {String} className the class name to search for
* @return {Boolean} A boolean value or array of boolean values
*/
'hasClass',
/**
* Adds a class name to a given element or collection of elements.
* @method addClass
* @param {String} className the class name to add to the class attribute
*/
'addClass',
/**
* Removes a class name from a given element or collection of elements.
* @method removeClass
* @param {String} className the class name to remove from the class attribute
*/
'removeClass',
/**
* Replace a class with another class for a given element or collection of elements.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
*/
'replaceClass',
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @param {String} className the class name to be toggled
*/
'toggleClass'
]);
/**
* This module applies adds support for positioning elements and
* normalizes window size and scroll detection.
* @module node-screen
*/
Y.each([
'winWidth',
'winHeight',
'docWidth',
'docHeight',
'docScrollX',
'docScrollY'
],
function(v, n) {
}
);
Y.Node.addDOMMethods([
/**
* Gets the current position of the node in page coordinates.
* Nodes must be part of the DOM tree to have page coordinates
* (display:none or nodes not appended return false).
* @method getXY
* @return {Array} The XY position of the node
*/
'getXY',
/**
* Set the position of a node in page coordinates, regardless of how the node is positioned.
* The node must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setXY
* @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
*/
'setXY'
]);
/**
* Extended Node interface for managing regions.
* @module node-region
*/
});
Y.Node.addDOMMethods([
'inViewportRegion'
]);
// these need special treatment to extract 2nd node arg
}
},
}
}
});
var NODE_TYPE = 'nodeType',
OWNER_DOCUMENT = 'ownerDocument',
DOCUMENT_ELEMENT = 'documentElement',
DEFAULT_VIEW = 'defaultView',
PARENT_WINDOW = 'parentWindow',
TAG_NAME = 'tagName',
PARENT_NODE = 'parentNode',
FIRST_CHILD = 'firstChild',
LAST_CHILD = 'lastChild',
PREVIOUS_SIBLING = 'previousSibling',
NEXT_SIBLING = 'nextSibling',
OFFSET_HEIGHT = 'offsetHeight',
OFFSET_WIDTH = 'offsetWidth',
CONTAINS = 'contains',
COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition',
INNER_TEXT = 'innerText',
TEXT_CONTENT = 'textContent',
CLIENT_HEIGHT = 'clientHeight',
CLIENT_WIDTH = 'clientWidth',
LENGTH = 'length',
STRING = 'string',
var re_tag = /<([a-z]+)/i;
var templateCache = {};
Y.DOM = {
/**
* Returns the HTMLElement with the given ID (Wrapper for document.getElementById).
* @method byId
* @param {String} id the id attribute
* @param {Object} doc optional The document to search. Defaults to current document
* @return {HTMLElement | null} The HTMLElement with the id, or null if none found.
*/
},
/**
* Returns the text content of the HTMLElement.
* @method getText
* @param {HTMLElement} element The html element.
* @return {String} The text content of the element (includes text of any descending elements).
*/
}
},
/**
* Finds the firstChild of the given HTMLElement.
* @method firstChild
* @param {HTMLElement} element The html element.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, the first found is returned.
* @return {HTMLElement | null} The first matching child html element.
*/
},
},
/**
* Finds the lastChild of the given HTMLElement.
* @method lastChild
* @param {HTMLElement} element The html element.
* @param {String} tag The tag to search for.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, the first found is returned.
* @return {HTMLElement | null} The first matching child html element.
*/
},
},
/**
* Finds all HTMLElement childNodes matching the given tag.
* @method childrenByTag
* @param {HTMLElement} element The html element.
* @param {String} tag The tag to search for.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all children with the given tag are collected.
* @return {Array} The collection of child elements.
*/
childrenByTag: function() {
var elements = [];
if (element) {
}
}
return elements; // @tested
};
} else {
var elements = [],
if (element) {
if (tag) { // wrap fn and add tag test TODO: allow tag in filterElementsBy?
};
}
}
return elements;
};
}
}(),
/**
* Finds all HTMLElement childNodes.
* @method children
* @param {HTMLElement} element The html element.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all children are collected.
* @return {Array} The collection of child elements.
*/
},
},
},
},
/**
* @method insertBefore
* @param {String | HTMLElement} newNode The node to be inserted
* @param {String | HTMLElement} referenceNode The node to insert the new node before
* @return {HTMLElement} The node that was inserted (or null if insert fails)
*/
if (!referenceNode) {
if (parentNode[FIRST_CHILD]) {
} else {
}
} else {
}
},
/**
* Inserts the new node as the next sibling of the reference node
* @method insertAfter
* @param {String | HTMLElement} newNode The node to be inserted
* @param {String | HTMLElement} referenceNode The node to insert the new node after
* @return {HTMLElement} The node that was inserted (or null if insert fails)
*/
if (referenceNode[NEXT_SIBLING]) {
} else {
}
},
/**
* Searches the element by the given axis for matching elements.
* @method elementsByAxis
* @param {HTMLElement} element The html element.
* @param {String} axis The axis to search (parentNode, nextSibling, previousSibling).
* @param {String} tag optional An optional tag to restrict the search to.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all elements along the axis are collected.
* @return {Array} The collection of elements.
*/
var ret = [];
}
}
return ret;
},
/**
* Searches the element by the given axis for the first matching element.
* @method elementByAxis
* @param {HTMLElement} element The html element.
* @param {String} axis The axis to search (parentNode, nextSibling, previousSibling).
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, the first element is returned.
* @return {HTMLElement | null} The matching element or null if none found.
*/
return element;
}
}
return null;
},
/**
* Finds all elements with the given tag.
* @method byTag
* @param {String} tag The tag being search for.
* @param {HTMLElement} root optional An optional root element to start from.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all elements with the given tag are returned.
* @return {Array} The collection of matching elements.
*/
retNodes = [];
}
}
return retNodes;
},
/**
* Finds the first element with the given tag.
* @method firstByTag
* @param {String} tag The tag being search for.
* @param {HTMLElement} root optional An optional root element to start from.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all elements with the given tag are returned.
* @return {Array} The collection of matching elements.
*/
ret = null;
break;
}
}
return ret;
},
/**
* Filters a collection of HTMLElements by the given attributes.
* @method filterElementsBy
* @param {Array} elements The collection of HTMLElements to filter.
* @param {Function} fn A boolean test to apply.
* The function is passed the current HTMLElement being tested as its only argument.
* If no function is given, all HTMLElements are kept.
* @return {Array} The filtered collection of HTMLElements.
*/
if (firstOnly) {
break;
} else {
}
}
}
return ret;
},
/**
* Determines whether or not one HTMLElement is or contains another HTMLElement.
* @method contains
* @param {HTMLElement} element The containing html element.
* @param {HTMLElement} needle The html element that may be contained.
* @return {Boolean} Whether or not the element is or contains the needle.
*/
var ret = false;
ret = false;
if (Y.UA.opera || needle[NODE_TYPE] === 1) { // IE & SAF contains fail if needle not an ELEMENT_NODE
} else {
}
ret = true;
}
}
return ret;
},
if (m && custom[m[1]]) {
} else {
}
}
//return ret.firstChild;
},
return frag;
},
/**
* Brute force version of contains.
* Used for browsers without contains support for non-HTMLElement Nodes (textNodes, etc).
* @method _bruteContains
* @private
* @param {HTMLElement} element The containing html element.
* @param {HTMLElement} needle The html element that may be contained.
* @return {Boolean} Whether or not the element is or contains the needle.
*/
while (needle) {
return true;
}
}
return false;
},
/**
* Memoizes dynamic regular expressions to boost runtime performance.
* @method _getRegExp
* @private
* @param {String} str The string to convert to a regular expression.
* @param {String} flags optional An optinal string of flags.
* @return {RegExp} An instance of RegExp
*/
}
},
/**
* returns the appropriate document.
* @method _getDoc
* @private
* @param {HTMLElement} element optional Target element.
* @return {Object} The document for the given element or the default document.
*/
},
/**
* returns the appropriate window.
* @method _getWin
* @private
* @param {HTMLElement} element optional Target element.
* @return {Object} The window for the given element or the default window.
*/
},
var ret = null,
if (element) {
if (rev) {
} else {
axis = NEXT_SIBLING;
}
} else { // need to scan nextSibling axis of firstChild to find matching element
}
}
return ret;
},
},
creators: {},
}
};
(function() {
var TABLE_OPEN = '<table>',
TABLE_CLOSE = '</table>';
return frag;
},
return frag.firstChild;
},
return frag.firstChild;
},
return frag;
},
legend: 'fieldset'
});
}
// TODO: allow multiples ("<link><link>")
}
return frag;
};
}
});
}
})();
/**
* Provides helper methods for collecting and filtering DOM elements.
* @class Selector
* @static
*/
var TAG = 'tag',
ATTRIBUTES = 'attributes',
PSEUDOS = 'pseudos',
COMBINATOR = 'combinator';
var patterns = {
pseudos: /^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i,
combinator: /^\s*([>+~]|\s)\s*/
};
Y.Selector = {
/**
* Default document for use queries
* @property document
* @type object
* @default window.document
*/
document: Y.config.doc,
/**
* Mapping of attributes to aliases, normally to work around HTMLAttributes
* that conflict with JS reserved words.
* @property attrAliases
* @type object
*/
attrAliases: {
},
/**
* Mapping of shorthand tokens to corresponding attribute selector
* @property shorthand
* @type object
*/
shorthand: {
},
/**
* List of operators and corresponding boolean functions.
*/
operators: {
var s = ' ';
},
'|=': function(attr, val) { return Y.DOM._getRegExp('^' + val + '[-]?').test(attr); }, // Match start with value followed by optional hyphen
'$=': function(attr, val) { return attr.lastIndexOf(val) === attr[LENGTH] - val[LENGTH]; }, // Match ends with value
},
/**
* List of pseudo-classes and corresponding boolean functions.
* These functions are called with the current node, and any value that was parsed with the pseudo regex.
* @property pseudos
* @type object
*/
pseudos: {
'root': function(node) {
},
},
},
},
},
'first-child': function(node) {
},
'last-child': function(node) {
},
},
},
'only-child': function(node) {
},
'only-of-type': function(node) {
},
'empty': function(node) {
},
},
},
'checked': function(node) {
}
},
/**
* Test if the supplied node matches the supplied selector.
* @method test
*
* @param {HTMLElement | String} node An id or node reference to the HTMLElement being tested.
* @param {string} selector The CSS Selector to test the node against.
* @return{boolean} Whether or not the node matches the selector.
* @static
*/
if (!node) {
return false;
}
return true;
}
}
return false;
}
},
/**
* Filters a set of nodes based on a given CSS selector.
* @method filter
*
* @param {string} selector The selector used to test each node.
* @return{array} An array of nodes from the supplied array that match the given selector.
* @static
*/
return result;
},
/**
* Retrieves a set of nodes based on a given CSS selector.
* @method query
*
* @param {string} selector The CSS Selector to test the node against.
* @param {HTMLElement | String} root optional An id or HTMLElement to start the query from. Defaults to Selector.document.
* @param {Boolean} firstOnly optional Whether or not to return only the first match.
* @return {Array} An array of nodes that match the given selector.
* @static
*/
return result;
},
if (!selector) {
return result;
}
var found;
}
Y.Selector._clearFoundCache();
return result;
}
nodes = [],
node,
id,
if (idToken) {
}
// use id shortcut when possible
if (id) {
} else {
}
}
} else {
return result;
}
}
}
}
return result;
},
return false;
}
if (deDupe) {
return false;
}
}
return true;
}, firstOnly);
return result;
},
i, len;
return false;
}
var attribute;
return false;
}
return false;
}
}
}
return false;
}
}
}
true;
},
_foundCache: [],
_regexCache: {},
_clearFoundCache: function() {
try { // IE no like delete
} catch(e) {
}
}
Y.Selector._foundCache = [];
},
combinators: {
return true;
}
}
return false;
},
},
}
return true;
}
return false;
},
while (sib) {
return true;
}
}
return false;
}
},
/*
an+b = get every _a_th node starting at the _b_th
0n+b = no repeat ("0" and "n" may both be omitted (together) , e.g. "0n+1" or "1", not "0+1"), return only the _b_th element
1n+b = get every element starting from b ("1" may may be omitted, e.g. "1n+0" or "n+0" or "n")
an+0 = get every _a_th element, "0" may be omitted
*/
var a = parseInt(RegExp.$1, 10), // include every _a_ elements (zero means no repeat, just first _a_)
n = RegExp.$2, // "n"
if (tag) {
} else {
}
if (oddeven) {
a = 2; // always every other
op = '+';
n = 'n';
} else if ( isNaN(a) ) {
a = (n) ? 1 : 0; // start from the first or no repeat
}
if (a === 0) { // just the first
if (reverse) {
}
return true;
} else {
return false;
}
} else if (a < 0) {
a = Math.abs(a);
}
if (!reverse) {
return true;
}
}
} else {
return true;
}
}
}
return false;
},
return attr[i][2];
}
}
},
_getIdTokenIndex: function(tokens) {
return i;
}
}
return -1;
},
/**
Break selector into token units per simple selector.
Combinator is attached to left-hand selector.
*/
var token = {}, // one token per simple selector (left selector holds combinator)
tokens = [], // array of tokens
found = false, // whether or not any matches were found this pass
match; // the regex match
/*
Search for selector patterns, store, and strip them from the selector string
until no patterns match (invalid selector) or we run out of chars.
Multiple attributes and pseudos are allowed, in any order.
for example:
'form:first-child[type=button]:not(button)[lang|=en]'
*/
do {
found = false; // reset after full pass
}
found = true;
//token[re] = token[re] || [];
// capture ID for fast path to element
}
} else { // single selector (tag, combinator)
}
token = { // prep next token
};
}
}
}
}
} while (found);
return tokens;
},
_fixAttributes: function(attr) {
}
}
}
return attr;
},
_replaceShorthand: function(selector) {
var attrs = selector.match(patterns[ATTRIBUTES]); // pull attributes to avoid false pos on "." and "#"
if (attrs) {
}
}
}
if (attrs) {
}
}
return selector;
}
};
}
/**
* Add className management functionality to DOM.
* @class DOMClassName
*
*/
var CLASS_NAME = 'className';
/**
* Determines whether an HTMLElement has the given className.
* @method hasClass
* @param {String} className the class name to search for
* @return {Boolean | Array} A boolean value or array of boolean values
*/
},
/**
* Adds a class name to a given element or collection of elements.
* @method addClass
* @param {String} className the class name to add to the class attribute
*/
}
},
/**
* Removes a class name from a given element or collection of elements.
* @method removeClass
* @param {String} className the class name to remove from the class attribute
*/
}
}
},
/**
* Replace a class with another class for a given element or collection of elements.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
*/
},
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @param {String} className the class name to be toggled
*/
} else {
}
}
});
/**
* Provides color conversion functionality.
* @class Color
*
*/
var TO_STRING = 'toString',
RE = RegExp,
Y.Color = {
KEYWORDS: {
black: '000',
silver: 'c0c0c0',
gray: '808080',
white: 'fff',
maroon: '800000',
red: 'f00',
purple: '800080',
fuchsia: 'f0f',
green: '008000',
lime: '0f0',
olive: '808000',
yellow: 'ff0',
navy: '000080',
blue: '00f',
teal: '008080',
aqua: '0ff'
},
val = 'rgb(' + [
}
return val;
},
val = [
].join('');
}
}
}
};
var STYLE = 'style',
FLOAT = 'float',
CSS_FLOAT = 'cssFloat',
STYLE_FLOAT = 'styleFloat',
TRANSPARENT = 'transparent',
VISIBLE = 'visible',
WIDTH = 'width',
HEIGHT = 'height',
BORDER_TOP_WIDTH = 'borderTopWidth',
BORDER_RIGHT_WIDTH = 'borderRightWidth',
BORDER_BOTTOM_WIDTH = 'borderBottomWidth',
BORDER_LEFT_WIDTH = 'borderLeftWidth',
GET_COMPUTED_STYLE = 'getComputedStyle',
CUSTOM_STYLES: {},
if (style) {
if (att in CUSTOM_STYLES) {
return; // NOTE: return
}
}
}
},
val = '';
if (style) {
if (att in CUSTOM_STYLES) {
}
}
}
}
return val;
},
var val = '',
}
return val;
}
});
}
}
return val;
};
}
if (val === 'rgba(0, 0, 0, 0)') {
val = TRANSPARENT;
}
return val;
};
}
/**
* @class DOMScreen
*/
var OFFSET_TOP = 'offsetTop',
COMPAT_MODE = 'compatMode',
OFFSET_LEFT = 'offsetLeft',
OFFSET_PARENT = 'offsetParent',
POSITION = 'position',
FIXED = 'fixed',
RELATIVE = 'relative',
LEFT = 'left',
TOP = 'top',
SCROLL_LEFT = 'scrollLeft',
SCROLL_TOP = 'scrollTop',
_BACK_COMPAT = 'BackCompat',
MEDIUM = 'medium',
GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect',
/**
* Returns the inner height of the viewport (exludes scrollbar).
* @method winHeight
*/
return h;
},
/**
* Returns the inner width of the viewport (exludes scrollbar).
* @method winWidth
*/
return w;
},
/**
* Document height
* @method docHeight
*/
},
/**
* Document width
* @method docWidth
*/
},
/**
* Amount page has been scroll vertically
* @method docScrollX
*/
docScrollX: function(node) {
},
/**
* Amount page has been scroll horizontally
* @method docScrollY
*/
docScrollY: function(node) {
},
/**
* Gets the current position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getXY
* @param element The target element
* @return {Array} The XY position of the element
TODO: test inDocument/display
*/
getXY: function() {
return function(node) {
//Round the numbers so we get sane data back
if (mode !== _BACK_COMPAT) {
off1 = 0;
off2 = 0;
}
}
if ((mode == _BACK_COMPAT)) {
}
}
}
}
if ((scrollTop || scrollLeft)) {
}
// gecko may return sub-pixel (non-int) values
return xy;
};
} else {
return function(node) { // manually calculate by crawling up offsetParents
//Calculate the Top and Left border sizes (assumes pixels)
parentNode = node,
if (bCheck) {
}
}
// account for any scrolled ancestors
parentNode = node;
var scrollTop, scrollLeft;
//Firefox does something funky with borders when overflow is not visible.
}
if (scrollTop || scrollLeft) {
}
}
} else {
//Fix FIXED position -- add scrollbars
}
}
//Round the numbers so we get sane data back
return xy;
};
}
}(),// NOTE: Executing for loadtime branching
/**
* Gets the current X position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getX
* @param element The target element
* @return {Int} The X position of the element
*/
},
/**
* Gets the current Y position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getY
* @param element The target element
* @return {Int} The Y position of the element
*/
},
/**
* Set the position of an html element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setXY
* @param element The target element
* @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
* @param {Boolean} noRetry By default we try and set the position a second time if the first fails
*/
delta = [ // assuming pixels; if not we will have to retry
];
}
if (currentXY === false) { // has to be part of doc to have xy
return false;
}
}
}
if (xy[0] !== null) {
}
if (xy[1] !== null) {
}
if (!noRetry) {
// if retry is true, try one more time if we miss
}
}
},
/**
* Set the X position of an html element in page coordinates, regardless of how the element is positioned.
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setX
* @param element The target element
* @param {Int} x The X values for new position (coordinates are page-based)
*/
},
/**
* Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setY
* @param element The target element
* @param {Int} y The Y values for new position (coordinates are page-based)
*/
},
t = 0;
l = 0;
}
}
xy2[0] += l;
xy2[1] += t;
return xy2;
},
_getWinSize: function(node) {
h = win.innerHeight,
w = win.innerWidth,
}
h = root[CLIENT_HEIGHT];
w = root[CLIENT_WIDTH];
}
},
_getDocSize: function(node) {
}
}
});
/**
* Adds region management functionality to DOM.
* @class DOMRegion
*
*/
return {
top: t,
bottom: b,
left: l,
right: r
};
};
/**
* Returns an Object literal containing the following about this node: (top, right, bottom, left) positions, height and width
* @method region
@return {Object} Object literal containing the following about this node: (top, right, bottom, left) positions, height and width
*/
ret = false;
if (x) {
ret = {
'0': x[0],
'1': x[1],
top: x[1],
left: x[0],
};
}
return ret;
},
/**
* Find the intersect information for this node and the node passed in.
* @method intersect
* @param {Object} node2 The node to check the interect with
* @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)
* @return {Object} Returns an Object literal with the intersect information for the nodes
*/
var n = node2;
if (n[TAG_NAME]) {
} else {
return false;
}
return {
};
},
/**
* Check if any part of this node is in the passed region
* @method inRegion
* @param {Object} node2 The node to get the region from or an Object literal of the region
* $param {Boolean} all Should all of the node be inside the region
* @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)
* @return {Boolean} True if in region, false if not.
*/
var region = {},
var n = node2;
if (n[TAG_NAME]) {
} else {
return false;
}
if (all) {
} else {
return true;
} else {
return false;
}
}
},
/**
* Check if any part of this node is in the viewport
* @method inViewportRegion
* $param {Boolean} all Should all of the node be inside the region
* @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)
* @return {Boolean} True if in region, false if not.
*/
},
viewportRegion: function(node) {
var r = {
};
return r;
}
});
var CLIENT_TOP = 'clientTop',
CLIENT_LEFT = 'clientLeft',
RIGHT = 'right',
HAS_LAYOUT = 'hasLayout',
PX = 'px',
FILTER = 'filter',
FILTERS = 'filters',
OPACITY = 'opacity',
AUTO = 'auto',
CURRENT_STYLE = 'currentStyle';
// use alpha filter for IE opacity
var val = 100;
try { // will error if no DXImageTransform
} catch(e) {
try { // make sure its in the document
} catch(err) {
}
}
return val / 100;
},
}
}
}
};
}
// IE getComputedStyle
// TODO: unit-less lineHeight (e.g. 1.22)
var ComputedStyle = {
CUSTOM_STYLES: {},
var value = '',
} else {
}
return value;
},
value = '';
value = 0;
}
// the difference is padding + border (works in Standards & Quirks modes)
}
}
} else { // convert units to px
if (!el[STYLE][pixel] && !el[STYLE][prop]) { // need to map style.width to currentStyle (no currentStyle.pixelWidth)
}
}
},
// clientHeight/Width = paddingBox (e.g. offsetWidth - borderWidth)
var value = null;
}
switch(property) {
case BORDER_TOP_WIDTH:
break;
case BORDER_BOTTOM_WIDTH:
break;
case BORDER_LEFT_WIDTH:
break;
case BORDER_RIGHT_WIDTH:
break;
}
},
// use pixelRight to convert to px
var val = null,
},
var val;
} else {
}
return val;
},
var current;
}
},
return true;
}
});
}
},
}
};
//fontSize: getPixelFont,
var IEComputed = {};
}
Y.namespace('DOM.IE');
}, '@VERSION@' );
(function() {
M = function(Y) {
var C = Y.config;
// apply the minimal required functionality
if (C.core) {
} else {
"aop",
"event-custom",
"event-target",
"event-ready",
"event-dom",
"event-facade",
"get",
"loader",
"dom",
"node",
"io");
}
};
// {
// the following will be bound automatically when this code is loaded
// use: core
// });
})();