src/cm/media/js/lib/yui/yui_3.0.0b1/build/compat/compat-debug.js
changeset 0 40c8f766c9b8
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 /*
       
     2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
       
     3 Code licensed under the BSD License:
       
     4 http://developer.yahoo.net/yui/license.txt
       
     5 version: 3.0.0b1
       
     6 build: 1163
       
     7 */
       
     8 YUI.add('compat', function(Y) {
       
     9 
       
    10 
       
    11 var COMPAT_ARG = '~yui|2|compat~';
       
    12 
       
    13 
       
    14 if (window.YAHOO != YUI) {
       
    15 
       
    16     // get any existing YAHOO obj props
       
    17     var o = (window.YAHOO) ? YUI.merge(window.YAHOO) : null;
       
    18 
       
    19     // Make the YUI global the YAHOO global
       
    20     window.YAHOO = YUI;
       
    21 
       
    22     // augment old YAHOO props
       
    23     if (o) {
       
    24         Y.mix(Y, o);
       
    25     }
       
    26 
       
    27 }
       
    28 
       
    29 
       
    30 /*
       
    31 if ((!globalUpdated) && (!(window.YAHOO instanceof YUI))) {
       
    32 
       
    33     globalUpdated = true;
       
    34 
       
    35     // get any existing YAHOO obj props
       
    36     var o = (window.YAHOO) ? YUI.merge(window.YAHOO) : null;
       
    37 
       
    38     // Make the YUI global the YAHOO global
       
    39     // window.YAHOO = YUI().use('node', 'compat');
       
    40     window.YAHOO = YUI().use('node', 'compat');
       
    41 
       
    42     // augment old YAHOO props
       
    43     if (o) {
       
    44         Y.mix(Y, o);
       
    45     }
       
    46 
       
    47 
       
    48 }
       
    49 */
       
    50 
       
    51 // add old namespaces
       
    52 Y.namespace("util", "widget", "example");
       
    53 
       
    54 // case/location change
       
    55 Y.env = (Y.env) ? Y.mix(Y.env, Y.Env) : Y.Env;
       
    56 Y.lang = (Y.lang) ? Y.mix(Y.lang, Y.Lang) : Y.Lang;
       
    57 Y.env.ua = Y.UA; 
       
    58 
       
    59 // support Y.register
       
    60 Y.mix(Y.env, {
       
    61         modules: [],
       
    62         listeners: [],
       
    63         getVersion: function(name) {
       
    64             return this.Env.modules[name] || null;
       
    65         }
       
    66 });
       
    67 
       
    68 var L = Y.lang;
       
    69 
       
    70 // add old lang properties 
       
    71 Y.mix(L, {
       
    72 
       
    73     augmentObject: function(r, s) {
       
    74         var a = arguments, wl = (a.length > 2) ? Y.Array(a, 2, true) : null;
       
    75         return Y.mix(r, s, (wl), wl);
       
    76     },
       
    77  
       
    78     augmentProto: function(r, s) {
       
    79         var a = arguments, wl = (a.length > 2) ? Y.Array(a, 2, true) : null;
       
    80         return Y.mix(r, s, (wl), wl, 1);
       
    81     },
       
    82 
       
    83     // extend: Y.bind(Y.extend, Y), 
       
    84     extend: Y.extend,
       
    85     // merge: Y.bind(Y.merge, Y)
       
    86     merge: Y.merge
       
    87 }, true);
       
    88 
       
    89 L.augment = L.augmentProto;
       
    90 
       
    91 // IE won't enumerate this
       
    92 L.hasOwnProperty = Y.Object.owns;
       
    93 
       
    94 // L.merge = Y.merge;
       
    95 
       
    96 Y.augmentProto = L.augmentProto;
       
    97 
       
    98 // add register function
       
    99 Y.mix(Y, {
       
   100     register: function(name, mainClass, data) {
       
   101         var mods = Y.Env.modules;
       
   102         if (!mods[name]) {
       
   103             mods[name] = { versions:[], builds:[] };
       
   104         }
       
   105         var m=mods[name],v=data.version,b=data.build,ls=Y.Env.listeners;
       
   106         m.name = name;
       
   107         m.version = v;
       
   108         m.build = b;
       
   109         m.versions.push(v);
       
   110         m.builds.push(b);
       
   111         m.mainClass = mainClass;
       
   112         // fire the module load listeners
       
   113         for (var i=0;i<ls.length;i=i+1) {
       
   114             ls[i](m);
       
   115         }
       
   116         // label the main class
       
   117         if (mainClass) {
       
   118             mainClass.VERSION = v;
       
   119             mainClass.BUILD = b;
       
   120         } else {
       
   121             Y.log("mainClass is undefined for module " + name, "warn");
       
   122         }
       
   123     }
       
   124 });
       
   125 
       
   126 // add old load listeners
       
   127 if ("undefined" !== typeof YAHOO_config) {
       
   128     var l=YAHOO_config.listener,ls=Y.Env.listeners,unique=true,i;
       
   129     if (l) {
       
   130         // if YAHOO is loaded multiple times we need to check to see if
       
   131         // this is a new config object.  If it is, add the new component
       
   132         // load listener to the stack
       
   133         for (i=0;i<ls.length;i=i+1) {
       
   134             if (ls[i]==l) {
       
   135                 unique=false;
       
   136                 break;
       
   137             }
       
   138         }
       
   139         if (unique) {
       
   140             ls.push(l);
       
   141         }
       
   142     }
       
   143 }
       
   144     
       
   145 // add old registration for yahoo
       
   146 Y.register("yahoo", Y, {version: "3.0.0b1", build: "1163"});
       
   147 
       
   148 if (Y.Event) {
       
   149 
       
   150     var o = {
       
   151         
       
   152         /**
       
   153          * Safari detection
       
   154          * @property isSafari
       
   155          * @private
       
   156          * @static
       
   157          * @deprecated use Y.Env.UA.webkit
       
   158          */
       
   159         isSafari: Y.UA.webkit,
       
   160         
       
   161         /**
       
   162          * webkit version
       
   163          * @property webkit
       
   164          * @type string
       
   165          * @private
       
   166          * @static
       
   167          * @deprecated use Y.Env.UA.webkit
       
   168          */
       
   169         webkit: Y.UA.webkit,
       
   170 
       
   171         /**
       
   172          * Normalized keycodes for webkit/safari
       
   173          * @property webkitKeymap
       
   174          * @type {int: int}
       
   175          * @private
       
   176          * @static
       
   177          * @final
       
   178          */
       
   179         webkitKeymap: {
       
   180             63232: 38, // up
       
   181             63233: 40, // down
       
   182             63234: 37, // left
       
   183             63235: 39, // right
       
   184             63276: 33, // page up
       
   185             63277: 34, // page down
       
   186             25: 9      // SHIFT-TAB (Safari provides a different key code in
       
   187                        // this case, even though the shiftKey modifier is set)
       
   188         },
       
   189         
       
   190         /**
       
   191          * IE detection 
       
   192          * @property isIE
       
   193          * @private
       
   194          * @static
       
   195          * @deprecated use Y.Env.UA.ie
       
   196          */
       
   197         isIE: Y.UA.ie,
       
   198 
       
   199         /**
       
   200          * Returns scrollLeft
       
   201          * @method _getScrollLeft
       
   202          * @static
       
   203          * @private
       
   204          */
       
   205         _getScrollLeft: function() {
       
   206             return this._getScroll()[1];
       
   207         },
       
   208 
       
   209         /**
       
   210          * Returns scrollTop
       
   211          * @method _getScrollTop
       
   212          * @static
       
   213          * @private
       
   214          */
       
   215         _getScrollTop: function() {
       
   216             return this._getScroll()[0];
       
   217         },
       
   218 
       
   219         /**
       
   220          * Returns the scrollTop and scrollLeft.  Used to calculate the 
       
   221          * pageX and pageY in Internet Explorer
       
   222          * @method _getScroll
       
   223          * @static
       
   224          * @private
       
   225          */
       
   226         _getScroll: function() {
       
   227             var d = Y.config.doc, dd = d.documentElement, db = d.body;
       
   228             if (dd && (dd.scrollTop || dd.scrollLeft)) {
       
   229                 return [dd.scrollTop, dd.scrollLeft];
       
   230             } else if (db) {
       
   231                 return [db.scrollTop, db.scrollLeft];
       
   232             } else {
       
   233                 return [0, 0];
       
   234             }
       
   235         },
       
   236 
       
   237         /**
       
   238          * Returns the event's pageX
       
   239          * @method getPageX
       
   240          * @param {Event} ev the event
       
   241          * @return {int} the event's pageX
       
   242          * @static
       
   243          */
       
   244         getPageX: function(ev) {
       
   245             var x = ev.pageX;
       
   246             if (!x && 0 !== x) {
       
   247                 x = ev.clientX || 0;
       
   248 
       
   249                 if ( Y.UA.ie ) {
       
   250                     x += this._getScrollLeft();
       
   251                 }
       
   252             }
       
   253 
       
   254             return x;
       
   255         },
       
   256 
       
   257         /**
       
   258          * Returns the charcode for an event
       
   259          * @method getCharCode
       
   260          * @param {Event} ev the event
       
   261          * @return {int} the event's charCode
       
   262          * @static
       
   263          */
       
   264         getCharCode: function(ev) {
       
   265             var code = ev.keyCode || ev.charCode || 0;
       
   266 
       
   267             // webkit normalization
       
   268             if (Y.UA.webkit && (code in Y.Event.webkitKeymap)) {
       
   269                 code = Y.Event.webkitKeymap[code];
       
   270             }
       
   271             return code;
       
   272         },
       
   273 
       
   274         /**
       
   275          * Returns the event's pageY
       
   276          * @method getPageY
       
   277          * @param {Event} ev the event
       
   278          * @return {int} the event's pageY
       
   279          * @static
       
   280          */
       
   281         getPageY: function(ev) {
       
   282             var y = ev.pageY;
       
   283             if (!y && 0 !== y) {
       
   284                 y = ev.clientY || 0;
       
   285 
       
   286                 if ( Y.UA.ie ) {
       
   287                     y += this._getScrollTop();
       
   288                 }
       
   289             }
       
   290 
       
   291 
       
   292             return y;
       
   293         },
       
   294 
       
   295         /**
       
   296          * Returns the pageX and pageY properties as an indexed array.
       
   297          * @method getXY
       
   298          * @param {Event} ev the event
       
   299          * @return {[x, y]} the pageX and pageY properties of the event
       
   300          * @static
       
   301          */
       
   302         getXY: function(ev) {
       
   303             return [this.getPageX(ev), this.getPageY(ev)];
       
   304         },
       
   305 
       
   306         /**
       
   307          * Returns the event's related target 
       
   308          * @method getRelatedTarget
       
   309          * @param {Event} ev the event
       
   310          * @return {HTMLElement} the event's relatedTarget
       
   311          * @static
       
   312          */
       
   313         getRelatedTarget: function(ev) {
       
   314             var t = ev.relatedTarget;
       
   315             if (!t) {
       
   316                 if (ev.type == "mouseout") {
       
   317                     t = ev.toElement;
       
   318                 } else if (ev.type == "mouseover") {
       
   319                     t = ev.fromElement;
       
   320                 }
       
   321             }
       
   322 
       
   323             return this.resolveTextNode(t);
       
   324         },
       
   325 
       
   326         /**
       
   327          * Returns the time of the event.  If the time is not included, the
       
   328          * event is modified using the current time.
       
   329          * @method getTime
       
   330          * @param {Event} ev the event
       
   331          * @return {Date} the time of the event
       
   332          * @static
       
   333          */
       
   334         getTime: function(ev) {
       
   335             if (!ev.time) {
       
   336                 var t = new Date().getTime();
       
   337                 try {
       
   338                     ev.time = t;
       
   339                 } catch(ex) { 
       
   340                     this.lastError = ex;
       
   341                     return t;
       
   342                 }
       
   343             }
       
   344 
       
   345             return ev.time;
       
   346         },
       
   347 
       
   348         /**
       
   349          * Convenience method for stopPropagation + preventDefault
       
   350          * @method stopEvent
       
   351          * @param {Event} ev the event
       
   352          * @static
       
   353          */
       
   354         stopEvent: function(ev) {
       
   355             this.stopPropagation(ev);
       
   356             this.preventDefault(ev);
       
   357         },
       
   358 
       
   359         /**
       
   360          * Stops event propagation
       
   361          * @method stopPropagation
       
   362          * @param {Event} ev the event
       
   363          * @static
       
   364          */
       
   365         stopPropagation: function(ev) {
       
   366             if (ev.stopPropagation) {
       
   367                 ev.stopPropagation();
       
   368             } else {
       
   369                 ev.cancelBubble = true;
       
   370             }
       
   371         },
       
   372 
       
   373         /**
       
   374          * Prevents the default behavior of the event
       
   375          * @method preventDefault
       
   376          * @param {Event} ev the event
       
   377          * @static
       
   378          */
       
   379         preventDefault: function(ev) {
       
   380             if (ev.preventDefault) {
       
   381                 ev.preventDefault();
       
   382             } else {
       
   383                 ev.returnValue = false;
       
   384             }
       
   385         },
       
   386 
       
   387         /**
       
   388          * Returns the event's target element.  Safari sometimes provides
       
   389          * a text node, and this is automatically resolved to the text
       
   390          * node's parent so that it behaves like other browsers.
       
   391          * @method getTarget
       
   392          * @param {Event} ev the event
       
   393          * @param {boolean} resolveTextNode when set to true the target's
       
   394          *                  parent will be returned if the target is a 
       
   395          *                  text node.  @deprecated, the text node is
       
   396          *                  now resolved automatically
       
   397          * @return {HTMLElement} the event's target
       
   398          * @static
       
   399          */
       
   400         getTarget: function(ev, resolveTextNode) {
       
   401             var t = ev.target || ev.srcElement;
       
   402             return this.resolveTextNode(t);
       
   403         },
       
   404 
       
   405         /**
       
   406          * In some cases, some browsers will return a text node inside
       
   407          * the actual element that was targeted.  This normalizes the
       
   408          * return value for getTarget and getRelatedTarget.
       
   409          * @method resolveTextNode
       
   410          * @param {HTMLElement} node node to resolve
       
   411          * @return {HTMLElement} the normized node
       
   412          * @static
       
   413          */
       
   414         resolveTextNode: function(node) {
       
   415             if (node && 3 == node.nodeType) {
       
   416                 return node.parentNode;
       
   417             } else {
       
   418                 return node;
       
   419             }
       
   420         },
       
   421 
       
   422         /**
       
   423          * We cache elements bound by id because when the unload event 
       
   424          * fires, we can no longer use document.getElementById
       
   425          * @method getEl
       
   426          * @static
       
   427          * @private
       
   428          * @deprecated Elements are not cached any longer
       
   429          */
       
   430         getEl: function(id) {
       
   431             return Y.get(id);
       
   432         }
       
   433     };
       
   434 
       
   435     Y.mix(Y.Event, o);
       
   436 
       
   437     /**
       
   438      * Calls Y.Event.attach with the correct argument order
       
   439      * @method removeListener
       
   440      */
       
   441     Y.Event.removeListener = function(el, type, fn, data, override) {
       
   442 
       
   443         var context, a=[type, fn, el];
       
   444 
       
   445         if (data) {
       
   446 
       
   447             if (override) {
       
   448                 context = (override === true) ? data : override;
       
   449             }
       
   450 
       
   451             a.push(context);
       
   452             a.push(data);
       
   453         }
       
   454 
       
   455         a.push(COMPAT_ARG);
       
   456 
       
   457         return Y.Event.detach.apply(Y.Event, a);
       
   458     };
       
   459 
       
   460     /**
       
   461      * Calls Y.Event.detach with the correct argument order
       
   462      * @method addListener
       
   463      */
       
   464     Y.Event.addListener = function(el, type, fn, data, override) {
       
   465 
       
   466         // Y.log('addListener:');
       
   467         // Y.log(Y.Array(arguments, 0, true), 1);
       
   468 
       
   469         // var a = Y.Array(arguments, 0, true), el = a.shift();
       
   470         // a.splice(2, 0, el);
       
   471         // return Y.Event.attach.apply(Y.Event, a);
       
   472         var context, a=[type, fn, el];
       
   473 
       
   474         if (data) {
       
   475 
       
   476             if (override) {
       
   477                 context = (override === true) ? data : override;
       
   478             }
       
   479 
       
   480             a.push(context);
       
   481             a.push(data);
       
   482         }
       
   483 
       
   484         a.push(COMPAT_ARG);
       
   485 
       
   486         return Y.Event.attach.apply(Y.Event, a);
       
   487     };
       
   488 
       
   489     Y.Event.on = Y.Event.addListener;
       
   490 
       
   491     var newOnavail = Y.Event.onAvailable;
       
   492 
       
   493     Y.Event.onAvailable = function(id, fn, p_obj, p_override) {
       
   494         return newOnavail(id, fn, p_obj, p_override, false, true);
       
   495     };
       
   496 
       
   497     Y.Event.onContentReady = function(id, fn, p_obj, p_override) {
       
   498         return newOnavail(id, fn, p_obj, p_override, true, true);
       
   499     };
       
   500 
       
   501     Y.Event.onDOMReady = function(fn) {
       
   502         var a = Y.Array(arguments, 0, true);
       
   503         a.unshift('event:ready');
       
   504         return Y.on.apply(Y, a);
       
   505     };
       
   506 
       
   507     Y.util.Event = Y.Event;
       
   508 
       
   509     var CE = function(type, oScope, silent, signature) {
       
   510         //debugger;
       
   511 
       
   512         var o = {
       
   513             context: oScope,
       
   514             silent: silent || false
       
   515             // signature: signature || CE.LIST
       
   516         };
       
   517 
       
   518         CE.superclass.constructor.call(this, type, o);
       
   519 
       
   520         this.signature = signature || CE.LIST;
       
   521     };
       
   522 
       
   523     Y.extend(CE, Y.CustomEvent, {
       
   524 
       
   525     });
       
   526 
       
   527     /**
       
   528      * Subscriber listener sigature constant.  The LIST type returns three
       
   529      * parameters: the event type, the array of args passed to fire, and
       
   530      * the optional custom object
       
   531      * @property YAHOO.util.CustomEvent.LIST
       
   532      * @static
       
   533      * @type int
       
   534      */
       
   535     CE.LIST = 0;
       
   536 
       
   537     /**
       
   538      * Subscriber listener sigature constant.  The FLAT type returns two
       
   539      * parameters: the first argument passed to fire and the optional 
       
   540      * custom object
       
   541      * @property YAHOO.util.CustomEvent.FLAT
       
   542      * @static
       
   543      * @type int
       
   544      */
       
   545     CE.FLAT = 1;
       
   546 
       
   547     Y.util.CustomEvent = CE;
       
   548 
       
   549     var EP = function() {
       
   550         //console.log('Compat CustomEvent constructor executed: ' + this._yuid);
       
   551         if (!this._yuievt) {
       
   552             var sub = this.subscribe;
       
   553             Y.EventTarget.apply(this, arguments);
       
   554             this.subscribe = sub;
       
   555             this.__yuiepinit = function() {};
       
   556         }
       
   557     };
       
   558 
       
   559     Y.extend(EP, Y.EventTarget, {
       
   560 
       
   561         createEvent: function(type, o) {
       
   562             o = o || {};
       
   563             o.signature = o.signature || CE.FLAT;
       
   564             return this.publish(type, o);
       
   565         },
       
   566 
       
   567         subscribe: function(type, fn, obj, override) {
       
   568             var ce = this._yuievt.events[type] || this.createEvent(type),
       
   569                 a = Y.Array(arguments);
       
   570 
       
   571             if (override && true !== override) {
       
   572                 // a[2] = override;
       
   573                 // a[1] = obj;
       
   574             }
       
   575 
       
   576             Y.EventTarget.prototype.subscribe.apply(this, a);
       
   577         },
       
   578 
       
   579         fireEvent: function(type) {
       
   580             return this.fire.apply(this, arguments);
       
   581         },
       
   582 
       
   583         hasEvent: function(type) {
       
   584             return this.getEvent(type);
       
   585         }
       
   586     });
       
   587 
       
   588     Y.util.EventProvider = EP;
       
   589 
       
   590 }
       
   591 
       
   592 
       
   593 Y.register("event", Y, {version: "3.0.0b1", build: "1163"});
       
   594 
       
   595 
       
   596 var propertyCache = {};
       
   597 var patterns = {
       
   598     HYPHEN: /(-[a-z])/i, // to normalize get/setStyle
       
   599     ROOT_TAG: /^body|html$/i, // body for quirks mode, html for standards,
       
   600     OP_SCROLL:/^(?:inline|table-row)$/i
       
   601 };
       
   602 
       
   603 var hyphenToCamel = function(property) {
       
   604     if ( !patterns.HYPHEN.test(property) ) {
       
   605         return property; // no hyphens
       
   606     }
       
   607     
       
   608     if (propertyCache[property]) { // already converted
       
   609         return propertyCache[property];
       
   610     }
       
   611    
       
   612     var converted = property;
       
   613 
       
   614     while( patterns.HYPHEN.exec(converted) ) {
       
   615         converted = converted.replace(RegExp.$1,
       
   616                 RegExp.$1.substr(1).toUpperCase());
       
   617     }
       
   618     
       
   619     propertyCache[property] = converted;
       
   620     return converted;
       
   621     //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
       
   622 };
       
   623 
       
   624 var Dom = {
       
   625     get: function(el) {
       
   626         if (el) {
       
   627             if (el.nodeType || el.item) { // Node, or NodeList
       
   628                 return el;
       
   629             }
       
   630 
       
   631             if (typeof el === 'string') { // id
       
   632                 return document.getElementById(el);
       
   633             }
       
   634             
       
   635             if ('length' in el) { // array-like 
       
   636                 var c = [];
       
   637                 for (var i = 0, len = el.length; i < len; ++i) {
       
   638                     c[c.length] = Dom.get(el[i]);
       
   639                 }
       
   640                 
       
   641                 return c;
       
   642             }
       
   643 
       
   644             return el; // some other object, just pass it back
       
   645         }
       
   646 
       
   647         return null;
       
   648     },
       
   649 
       
   650     isAncestor: function(haystack, needle) {
       
   651         return YUI.DOM.contains(Dom.get(haystack), Dom.get(needle));
       
   652     },
       
   653 
       
   654     inDocument: function(el) {
       
   655         return Dom.isAncestor(Y.config.doc.documentElement, el);
       
   656     },
       
   657    
       
   658     batch: function(el, method, o, override, args) {
       
   659         el = (el && (el.tagName || el.item)) ? el : Dom.get(el); // skip get() when possible 
       
   660 
       
   661         if (!el || !method) { 
       
   662             return false; 
       
   663         }  
       
   664         if (args) {
       
   665             args = Y.Array(args);
       
   666         }
       
   667         var scope = (override) ? o : window; 
       
   668          
       
   669         var apply = function(el) {
       
   670             if (args) {
       
   671                 var tmp = slice.call(args);
       
   672                 tmp.unshift(el);
       
   673                 return method.apply(scope, tmp);
       
   674             } else {
       
   675                 return method.call(scope, el, o);
       
   676             }
       
   677         };
       
   678 
       
   679         if (el.tagName || el.length === undefined) { // element or not array-like  
       
   680             return apply(el); 
       
   681         }  
       
   682 
       
   683         var collection = []; 
       
   684          
       
   685         for (var i = 0, len = el.length; i < len; ++i) { 
       
   686             collection[collection.length] = apply(el[i]);
       
   687         } 
       
   688         
       
   689         return collection;
       
   690     },
       
   691 
       
   692     // 2.x returns false if already present
       
   693     _addClass: function(el, className) {
       
   694         if ( YUI.DOM.hasClass(el, className) ) {
       
   695             return false;
       
   696         }
       
   697 
       
   698         YUI.DOM.addClass(el, className);
       
   699         return true;
       
   700     },
       
   701 
       
   702     // 2.x returns false if not present
       
   703     _removeClass: function(el, className) {
       
   704         if ( !YUI.DOM.hasClass(el, className) ) {
       
   705             return false;
       
   706         }
       
   707 
       
   708         YUI.DOM.removeClass(el, className);
       
   709         return true;
       
   710     },
       
   711 
       
   712     // 2.x returns false if no newClass or same as oldClass
       
   713     _replaceClass: function(el, oldClass, newClass) {
       
   714         if (!newClass || oldClass === newClass) {
       
   715             return false;
       
   716         }
       
   717 
       
   718         YUI.DOM.replaceClass(el, oldClass, newClass);
       
   719         return true;
       
   720     },
       
   721 
       
   722     getElementsByClassName: function(className, tag, root) {
       
   723         tag = tag || '*';
       
   724         root = (root) ? Dom.get(root) : Y.config.doc; 
       
   725         var nodes = [];
       
   726         if (root) {
       
   727             nodes = Y.Selector.query(tag + '.' + className, root);
       
   728         }
       
   729         return nodes;
       
   730     },
       
   731 
       
   732     getElementsBy: function(method, tag, root) {
       
   733         tag = tag || '*';
       
   734         root = (root) ? Dom.get(root) : null || document;
       
   735 
       
   736         var nodes = [];
       
   737         if (root) {
       
   738             nodes = YUI.DOM.byTag(tag, root, method);
       
   739         }
       
   740         return nodes;
       
   741     },
       
   742 
       
   743     getViewportWidth: YUI.DOM.winWidth,
       
   744     getViewportHeight: YUI.DOM.winHeight,
       
   745     getDocumentWidth: YUI.DOM.docWidth,
       
   746     getDocumentHeight: YUI.DOM.docHeight,
       
   747     getDocumentScrollTop: YUI.DOM.docScrollY,
       
   748     getDocumentScrollLeft: YUI.DOM.docScrollX,
       
   749     getDocumentHeight: YUI.DOM.docHeight,
       
   750 
       
   751     _guid: function(el, prefix) {
       
   752         prefix = prefix || 'yui-gen';
       
   753         Dom._id_counter = Dom._id_counter || 0;
       
   754 
       
   755         if (el && el.id) { // do not override existing ID
       
   756             return el.id;
       
   757         } 
       
   758 
       
   759         var id = prefix + Dom._id_counter++;
       
   760 
       
   761         if (el) {
       
   762             el.id = id;
       
   763         }
       
   764         
       
   765         return id;
       
   766     },
       
   767 
       
   768     _region: function(el) {
       
   769         if ( (el.parentNode === null || el.offsetParent === null ||
       
   770                 YUI.DOM.getStyle(el, 'display') == 'none') && el != el.ownerDocument.body) {
       
   771             return false;
       
   772         }
       
   773 
       
   774         return YUI.DOM.region(el);
       
   775 
       
   776     },
       
   777 
       
   778     _ancestorByClass: function(element, className) {
       
   779         return YUI.DOM.ancestor(element, function(el) {
       
   780             return YUI.DOM.hasClass(el, className);
       
   781         });
       
   782     },
       
   783 
       
   784     _ancestorByTag: function(element, tag) {
       
   785         tag = tag.toUpperCase();
       
   786         return YUI.DOM.ancestor(element, function(el) {
       
   787             return el.tagName.toUpperCase() === tag;
       
   788         });
       
   789     }
       
   790 };
       
   791 
       
   792 var slice = [].slice;
       
   793 
       
   794 var wrap = function(fn, name) {
       
   795     Dom[name] = function() {
       
   796         var args = slice.call(arguments);
       
   797         args[0] = Dom.get(args[0]);
       
   798         return fn.apply(Dom, args);
       
   799     };
       
   800 };
       
   801 
       
   802 var wrapped = {
       
   803     getAncestorBy: YUI.DOM.ancestor,
       
   804     getAncestorByClassName: Dom._ancestorByClass,
       
   805     getAncestorByTagName: Dom._ancestorByTag,
       
   806     getPreviousSiblingBy: YUI.DOM.previous,
       
   807     getPreviousSibling: YUI.DOM.previous,
       
   808     getNextSiblingBy: YUI.DOM.next,
       
   809     getNextSibling: YUI.DOM.next,
       
   810     getFirstChildBy: YUI.DOM.firstChild,
       
   811     getFirstChild: YUI.DOM.firstChild,
       
   812     getLastChildBy: YUI.DOM.lastChild,
       
   813     getLastChild: YUI.DOM.lastChild,
       
   814     getChildrenBy: YUI.DOM.children,
       
   815     getChildren: YUI.DOM.children,
       
   816     insertBefore: function(newNode, refNode) {
       
   817         YUI.DOM.insertBefore(Dom.get(newNode), Dom.get(refNode));
       
   818     },
       
   819     insertAfter: function(newNode, refNode) {
       
   820         YUI.DOM.insertAfter(Dom.get(newNode), Dom.get(refNode));
       
   821     }
       
   822 };
       
   823 
       
   824 Y.each(wrapped, wrap);
       
   825 
       
   826 var batched = {
       
   827     getStyle: YUI.DOM.getStyle,
       
   828     setStyle: YUI.DOM.setStyle,
       
   829     getXY: YUI.DOM.getXY,
       
   830     setXY: YUI.DOM.setXY,
       
   831     getX: YUI.DOM.getX,
       
   832     getY: YUI.DOM.getY,
       
   833     setX: YUI.DOM.setX, 
       
   834     setY: YUI.DOM.setY, 
       
   835     getRegion: Dom._region,
       
   836     hasClass: YUI.DOM.hasClass,
       
   837     addClass: Dom._addClass,
       
   838     removeClass: Dom._removeClass,
       
   839     replaceClass: Dom._replaceClass,
       
   840     generateId: Dom._guid
       
   841 };
       
   842 
       
   843 Y.each(batched, function(v, n) {
       
   844     Dom[n] = function(el) {
       
   845         var args = slice.call(arguments, 1);
       
   846         return Dom.batch(el, v, null, null, args);
       
   847     };
       
   848 });
       
   849 
       
   850 Y.util.Dom = Dom;
       
   851 
       
   852 YAHOO.util.Region = function(t, r, b, l) {
       
   853     this.top = t;
       
   854     this[1] = t;
       
   855     this.right = r;
       
   856     this.bottom = b;
       
   857     this.left = l;
       
   858     this[0] = l;
       
   859 };
       
   860 
       
   861 YAHOO.util.Region.prototype.contains = function(region) {
       
   862     return ( region.left   >= this.left   && 
       
   863              region.right  <= this.right  && 
       
   864              region.top    >= this.top    && 
       
   865              region.bottom <= this.bottom    );
       
   866 
       
   867     // this.logger.debug("does " + this + " contain " + region + " ... " + ret);
       
   868 };
       
   869 
       
   870 YAHOO.util.Region.prototype.getArea = function() {
       
   871     return ( (this.bottom - this.top) * (this.right - this.left) );
       
   872 };
       
   873 
       
   874 YAHOO.util.Region.prototype.intersect = function(region) {
       
   875     var t = Math.max( this.top,    region.top    );
       
   876     var r = Math.min( this.right,  region.right  );
       
   877     var b = Math.min( this.bottom, region.bottom );
       
   878     var l = Math.max( this.left,   region.left   );
       
   879     
       
   880     if (b >= t && r >= l) {
       
   881         return new YAHOO.util.Region(t, r, b, l);
       
   882     } else {
       
   883         return null;
       
   884     }
       
   885 };
       
   886 
       
   887 YAHOO.util.Region.prototype.union = function(region) {
       
   888     var t = Math.min( this.top,    region.top    );
       
   889     var r = Math.max( this.right,  region.right  );
       
   890     var b = Math.max( this.bottom, region.bottom );
       
   891     var l = Math.min( this.left,   region.left   );
       
   892 
       
   893     return new YAHOO.util.Region(t, r, b, l);
       
   894 };
       
   895 
       
   896 YAHOO.util.Region.prototype.toString = function() {
       
   897     return ( "Region {"    +
       
   898              "top: "       + this.top    + 
       
   899              ", right: "   + this.right  + 
       
   900              ", bottom: "  + this.bottom + 
       
   901              ", left: "    + this.left   + 
       
   902              "}" );
       
   903 };
       
   904 
       
   905 YAHOO.util.Region.getRegion = function(el) {
       
   906     return YUI.DOM.region(el);
       
   907 };
       
   908 
       
   909 YAHOO.util.Point = function(x, y) {
       
   910    if (YAHOO.lang.isArray(x)) { // accept input from Dom.getXY, Event.getXY, etc.
       
   911       y = x[1]; // dont blow away x yet
       
   912       x = x[0];
       
   913    }
       
   914    
       
   915     this.x = this.right = this.left = this[0] = x;
       
   916     this.y = this.top = this.bottom = this[1] = y;
       
   917 };
       
   918 
       
   919 YAHOO.util.Point.prototype = new YAHOO.util.Region();
       
   920 
       
   921 
       
   922 
       
   923 }, '3.0.0b1' ,{requires:['dom','event']});
       
   924 YUI._setup(); YUI.use('dom', 'event', 'compat');