~bjornt/lazr-js/prefetch-yui-3.5

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/compat/compat-debug.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-01-14 23:32:29 UTC
  • mfrom: (197.1.7 yui-3.3.0)
  • Revision ID: launchpad@pqm.canonical.com-20110114233229-r6i4cazdiiw18o7p
Upgrade to YUI 3.3.0 [r=mars]

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.2.0
6
 
build: 2676
 
5
version: 3.3.0
 
6
build: 3167
7
7
*/
8
8
YUI.add('compat', function(Y) {
9
9
 
12
12
/*global YUI*/
13
13
/*global YUI_config*/
14
14
 
15
 
var COMPAT_ARG = '~yui|2|compat~';
 
15
var COMPAT_ARG = '~yui|2|compat~', o, L;
16
16
 
17
17
 
18
18
if (window.YAHOO != YUI) {
19
19
 
20
20
    // get any existing YAHOO obj props
21
 
    var o = (window.YAHOO) ? YUI.merge(window.YAHOO) : null;
 
21
    o = (window.YAHOO) ? YUI.merge(window.YAHOO) : null;
22
22
 
23
23
    // Make the YUI global the YAHOO global
24
24
    window.YAHOO = YUI;
35
35
// case/location change
36
36
Y.env = (Y.env) ? Y.mix(Y.env, Y.Env) : Y.Env;
37
37
Y.lang = (Y.lang) ? Y.mix(Y.lang, Y.Lang) : Y.Lang;
38
 
Y.env.ua = Y.UA; 
 
38
Y.env.ua = Y.UA;
39
39
 
40
40
// support Y.register
41
41
Y.mix(Y.env, {
46
46
        }
47
47
});
48
48
 
49
 
var L = Y.lang;
 
49
L = Y.lang;
50
50
 
51
 
// add old lang properties 
 
51
// add old lang properties
52
52
Y.mix(L, {
53
53
 
54
54
    augmentObject: function(r, s) {
61
61
 
62
62
        return Y.mix.apply(Y, args);
63
63
    },
64
 
 
 
64
 
65
65
    augmentProto: function(r, s) {
66
66
        var a = arguments, wl = (a.length > 2) ? Y.Array(a, 2, true) : null,
67
67
            ov = (wl), args = [r, s, ov];
68
68
        return Y.augment.apply(Y, args);
69
69
    },
70
70
 
71
 
    // extend: Y.bind(Y.extend, Y), 
 
71
    // extend: Y.bind(Y.extend, Y),
72
72
    extend: Y.extend,
73
73
    // merge: Y.bind(Y.merge, Y)
74
74
    merge: Y.merge
128
128
        }
129
129
    }
130
130
}
131
 
    
 
131
 
132
132
// add old registration for yahoo
133
 
Y.register("yahoo", Y, {version: "3.2.0", build: "2676"});
 
133
Y.register("yahoo", Y, {version: "3.3.0", build: "3167"});
134
134
 
135
135
if (Y.Event) {
136
136
 
137
137
    o = {
138
 
        
 
138
 
139
139
        /**
140
140
         * Safari detection
141
141
         * @property isSafari
144
144
         * @deprecated use Y.Env.UA.webkit
145
145
         */
146
146
        isSafari: Y.UA.webkit,
147
 
        
 
147
 
148
148
        /**
149
149
         * webkit version
150
150
         * @property webkit
173
173
            25: 9      // SHIFT-TAB (Safari provides a different key code in
174
174
                       // this case, even though the shiftKey modifier is set)
175
175
        },
176
 
        
 
176
 
177
177
        /**
178
 
         * IE detection 
 
178
         * IE detection
179
179
         * @property isIE
180
180
         * @private
181
181
         * @static
204
204
        },
205
205
 
206
206
        /**
207
 
         * Returns the scrollTop and scrollLeft.  Used to calculate the 
 
207
         * Returns the scrollTop and scrollLeft.  Used to calculate the
208
208
         * pageX and pageY in Internet Explorer
209
209
         * @method _getScroll
210
210
         * @static
291
291
        },
292
292
 
293
293
        /**
294
 
         * Returns the event's related target 
 
294
         * Returns the event's related target
295
295
         * @method getRelatedTarget
296
296
         * @param {Event} ev the event
297
297
         * @return {HTMLElement} the event's relatedTarget
323
323
                var t = new Date().getTime();
324
324
                try {
325
325
                    ev.time = t;
326
 
                } catch(ex) { 
 
326
                } catch(ex) {
327
327
                    this.lastError = ex;
328
328
                    return t;
329
329
                }
378
378
         * @method getTarget
379
379
         * @param {Event} ev the event
380
380
         * @param {boolean} resolveTextNode when set to true the target's
381
 
         *                  parent will be returned if the target is a 
 
381
         *                  parent will be returned if the target is a
382
382
         *                  text node.  @deprecated, the text node is
383
383
         *                  now resolved automatically
384
384
         * @return {HTMLElement} the event's target
407
407
        },
408
408
 
409
409
        /**
410
 
         * We cache elements bound by id because when the unload event 
 
410
         * We cache elements bound by id because when the unload event
411
411
         * fires, we can no longer use document.getElementById
412
412
         * @method getEl
413
413
         * @static
523
523
 
524
524
    /**
525
525
     * Subscriber listener sigature constant.  The FLAT type returns two
526
 
     * parameters: the first argument passed to fire and the optional 
 
526
     * parameters: the first argument passed to fire and the optional
527
527
     * custom object
528
528
     * @property YAHOO.util.CustomEvent.FLAT
529
529
     * @static
583
583
}
584
584
 
585
585
 
586
 
Y.register("event", Y, {version: "3.2.0", build: "2676"});
 
586
Y.register("event", Y.util.Event, {version: "3.3.0", build: "3167"});
587
587
 
588
588
 
589
589
var propertyCache = {};
598
598
    if ( !patterns.HYPHEN.test(property) ) {
599
599
        return property; // no hyphens
600
600
    }
601
 
    
 
601
 
602
602
    if (propertyCache[property]) { // already converted
603
603
        return propertyCache[property];
604
604
    }
605
 
   
 
605
 
606
606
    var converted = property;
607
607
 
608
608
    while( patterns.HYPHEN.exec(converted) ) {
609
609
        converted = converted.replace(RegExp.$1,
610
610
                RegExp.$1.substr(1).toUpperCase());
611
611
    }
612
 
    
 
612
 
613
613
    propertyCache[property] = converted;
614
614
    return converted;
615
615
    //return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
616
616
};
617
617
 
618
618
var Dom = {
 
619
    _firstChild: function(node) {
 
620
        return Y.Selector.query('> *', node, true);
 
621
    },
 
622
 
619
623
    get: function(el) {
620
624
        if (el) {
621
625
            if (el.nodeType || el.item) { // Node, or NodeList
625
629
            if (typeof el === 'string') { // id
626
630
                return document.getElementById(el);
627
631
            }
628
 
            
629
 
            if ('length' in el) { // array-like 
 
632
 
 
633
            if ('length' in el) { // array-like
630
634
                var c = [];
631
635
                for (var i = 0, len = el.length; i < len; ++i) {
632
636
                    c[c.length] = Dom.get(el[i]);
633
637
                }
634
 
                
 
638
 
635
639
                return c;
636
640
            }
637
641
 
648
652
    inDocument: function(el) {
649
653
        return Dom.isAncestor(Y.config.doc.documentElement, el);
650
654
    },
651
 
   
 
655
 
652
656
    batch: function(el, method, o, override, args) {
653
 
        el = (el && (el.tagName || el.item)) ? el : Dom.get(el); // skip get() when possible 
 
657
        el = (el && (el.tagName || el.item)) ? el : Dom.get(el); // skip get() when possible
654
658
 
655
 
        if (!el || !method) { 
656
 
            return false; 
657
 
        }  
 
659
        if (!el || !method) {
 
660
            return false;
 
661
        }
658
662
        if (args) {
659
663
            args = Y.Array(args);
660
664
        }
661
 
        var scope = (override) ? o : window; 
662
 
         
 
665
        var scope = (override) ? o : window;
 
666
 
663
667
        var apply = function(el) {
664
668
            if (args) {
665
669
                var tmp = slice.call(args);
670
674
            }
671
675
        };
672
676
 
673
 
        if (el.tagName || el.length === undefined) { // element or not array-like  
674
 
            return apply(el); 
675
 
        }  
676
 
 
677
 
        var collection = []; 
678
 
         
679
 
        for (var i = 0, len = el.length; i < len; ++i) { 
 
677
        if (el.tagName || el.length === undefined) { // element or not array-like
 
678
            return apply(el);
 
679
        }
 
680
 
 
681
        var collection = [];
 
682
 
 
683
        for (var i = 0, len = el.length; i < len; ++i) {
680
684
            collection[collection.length] = apply(el[i]);
681
 
        } 
682
 
        
 
685
        }
 
686
 
683
687
        return collection;
684
688
    },
685
689
 
715
719
 
716
720
    getElementsByClassName: function(className, tag, root) {
717
721
        tag = tag || '*';
718
 
        root = (root) ? Dom.get(root) : Y.config.doc; 
 
722
        root = (root) ? Dom.get(root) : Y.config.doc;
719
723
        var nodes = [];
720
724
        if (root) {
721
725
            nodes = Y.Selector.query(tag + '.' + className, root);
727
731
        tag = tag || '*';
728
732
        root = (root) ? Dom.get(root) : null || document;
729
733
 
730
 
        var nodes = [];
731
 
        if (root) {
732
 
            nodes = YUI.DOM.byTag(tag, root, method);
733
 
        }
 
734
 
 
735
        var nodes = Y.Selector.query(tag, root);
734
736
        return nodes;
735
737
    },
736
738
 
747
749
 
748
750
        if (el && el.id) { // do not override existing ID
749
751
            return el.id;
750
 
        } 
 
752
        }
751
753
 
752
754
        var id = prefix + Dom._id_counter++;
753
755
 
754
756
        if (el) {
755
757
            el.id = id;
756
758
        }
757
 
        
 
759
 
758
760
        return id;
759
761
    },
760
762
 
799
801
    getPreviousSibling: YUI.DOM.previous,
800
802
    getNextSiblingBy: YUI.DOM.next,
801
803
    getNextSibling: YUI.DOM.next,
802
 
    getFirstChildBy: YUI.DOM.firstChild,
803
 
    getFirstChild: YUI.DOM.firstChild,
 
804
    getFirstChildBy: Dom._firstChild,
 
805
    getFirstChild: Dom._firstChild,
804
806
    getLastChildBy: YUI.DOM.lastChild,
805
807
    getLastChild: YUI.DOM.lastChild,
806
808
    getChildrenBy: YUI.DOM.children,
822
824
    setXY: YUI.DOM.setXY,
823
825
    getX: YUI.DOM.getX,
824
826
    getY: YUI.DOM.getY,
825
 
    setX: YUI.DOM.setX, 
826
 
    setY: YUI.DOM.setY, 
 
827
    setX: YUI.DOM.setX,
 
828
    setY: YUI.DOM.setY,
827
829
    getRegion: Dom._region,
828
830
    hasClass: YUI.DOM.hasClass,
829
831
    addClass: Dom._addClass,
851
853
};
852
854
 
853
855
YAHOO.util.Region.prototype.contains = function(region) {
854
 
    return ( region.left   >= this.left   && 
855
 
             region.right  <= this.right  && 
856
 
             region.top    >= this.top    && 
 
856
    return ( region.left   >= this.left   &&
 
857
             region.right  <= this.right  &&
 
858
             region.top    >= this.top    &&
857
859
             region.bottom <= this.bottom    );
858
860
 
859
861
    // this.logger.debug("does " + this + " contain " + region + " ... " + ret);
868
870
    var r = Math.min( this.right,  region.right  );
869
871
    var b = Math.min( this.bottom, region.bottom );
870
872
    var l = Math.max( this.left,   region.left   );
871
 
    
 
873
 
872
874
    if (b >= t && r >= l) {
873
875
        return new YAHOO.util.Region(t, r, b, l);
874
876
    } else {
887
889
 
888
890
YAHOO.util.Region.prototype.toString = function() {
889
891
    return ( "Region {"    +
890
 
             "top: "       + this.top    + 
891
 
             ", right: "   + this.right  + 
892
 
             ", bottom: "  + this.bottom + 
893
 
             ", left: "    + this.left   + 
 
892
             "top: "       + this.top    +
 
893
             ", right: "   + this.right  +
 
894
             ", bottom: "  + this.bottom +
 
895
             ", left: "    + this.left   +
894
896
             "}" );
895
897
};
896
898
 
903
905
      y = x[1]; // dont blow away x yet
904
906
      x = x[0];
905
907
   }
906
 
   
 
908
 
907
909
    this.x = this.right = this.left = this[0] = x;
908
910
    this.y = this.top = this.bottom = this[1] = y;
909
911
};
910
912
 
911
913
YAHOO.util.Point.prototype = new YAHOO.util.Region();
912
914
 
913
 
 
914
 
 
915
 
}, '3.2.0' ,{requires:['dom','event-base','dump','substitute']});
 
915
YAHOO.register("dom", YAHOO.util.Dom, {version: "3.3.0", build: "3167"});
 
916
 
 
917
 
 
918
 
 
919
}, '3.3.0' ,{requires:['dom','dom-style-ie','event-base','dump','substitute']});
916
920
YUI._setup(); YUI.use('compat');