~ubuntu-branches/ubuntu/lucid/loggerhead/lucid-security

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/yui-base/yui-base-debug.js

  • Committer: Bazaar Package Importer
  • Author(s): James Westby, Roland Mas, Jelmer Vernooij, James Westby
  • Date: 2009-08-26 13:18:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090826131803-0ce1fhaetci8b0c5
Tags: 1.17-0ubuntu1
[ Roland Mas ]
* Use the YUI library provided by libjs-yui. (Closes: #511286)

[ Jelmer Vernooij ]
* Use my debian.org address in Uploaders field.
* Add ${misc:Depends} to please lintian.
* Suggest recent version of paste, which doesn't expose internal port
  numbers in links. (Closes: #507000)
* Bump standards version to 3.8.1.

[ James Westby ]
* New upstream release.
* Drop get-orig-source rule in favour of debian/watch.
* Add python-pkg-resources and python-paste to Build-Depends,
  python-pkg-resources to Depends and python-simplejson to
  Recommends due to dependency changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.net/yui/license.txt
5
 
version: 3.0.0pr1
 
5
version: 3.0.0pr2
6
6
*/
7
7
/**
8
8
 * YUI core
41
41
     *  <li>------------------------------------------------------------------------</li>
42
42
     *  <li>debug:
43
43
     *  Turn debug statements on or off</li>
44
 
     *  <li>useConsole:
 
44
     *  <li>useBrowserConsole:
45
45
     *  Log to the browser console if debug is on and the console is available</li>
46
46
     *  <li>logInclude:
47
47
     *  A hash of log sources that should be logged.  If specified, only log messages from these sources will be logged.
125
125
    /*global YUI*/
126
126
    YUI = function(o) {
127
127
        var Y = this;
128
 
        // Allow var yui = YUI() instead of var yui = new YUI()
129
 
        if (Y == window) {
 
128
 
 
129
        // Allow instantiation without the new operator
 
130
        if (!(Y instanceof YUI)) {
130
131
            return new YUI(o);
131
132
        } else {
132
133
            // set up the core environment
159
160
        o.win = w;
160
161
        o.doc = w.document;
161
162
        o.debug = ('debug' in o) ? o.debug : true;
162
 
        o.useConsole = ('useConsole' in o) ? o.useConsole: true;
163
 
 
164
 
        // @TODO default throwFail to true in PR2
165
 
        // o.throwFail = ('throwFail' in o) ? o.debug : true;
 
163
        o.useBrowserConsole = ('useBrowserConsole' in o) ? o.useBrowserConsole : true;
 
164
        o.throwFail = ('throwFail' in o) ? o.throwFail : true;
166
165
    
167
166
        // add a reference to o for anything that needs it
168
167
        // before _setup is called.
244
243
     * Register a module
245
244
     * @method add
246
245
     * @param name {string} module name
247
 
     * @param namespace {string} name space for the module
248
246
     * @param fn {Function} entry point into the module that
249
247
     * is used to bind module to the YUI instance
250
248
     * @param version {string} version string
371
369
        // Y.log('loader before: ' + a.join(','));
372
370
       
373
371
 
374
 
        // use loader to optimize and sort the requirements if it
375
 
        // is available.
 
372
        // use loader to expand dependencies and sort the 
 
373
        // requirements if it is available.
376
374
        if (Y.Loader) {
377
375
            dynamic = true;
378
376
            loader = new Y.Loader(Y.config);
379
377
            loader.require(a);
380
378
            loader.ignoreRegistered = true;
 
379
            loader.allowRollup = false;
381
380
            loader.calculate();
382
381
            a = loader.sorted;
383
382
        }
475
474
     * Returns the namespace specified and creates it if it doesn't exist
476
475
     * <pre>
477
476
     * YUI.namespace("property.package");
478
 
     * YUI.namespace("YUI.property.package");
 
477
     * YUI.namespace("YAHOO.property.package");
479
478
     * </pre>
480
 
     * Either of the above would create YUI.property, then
 
479
     * Either of the above would create YAHOO.property, then
481
480
     * YUI.property.package
482
481
     *
483
482
     * Be careful when naming packages. Reserved words may work in some browsers
496
495
        for (i=0; i<a.length; i=i+1) {
497
496
            d = a[i].split(".");
498
497
            o = this;
499
 
            for (j=(d[0] == "YUI") ? 1 : 0; j<d.length; j=j+1) {
 
498
            for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
500
499
                o[d[j]] = o[d[j]] || {};
501
500
                o = o[d[j]];
502
501
            }
521
520
     * @return {YUI} this YUI instance
522
521
     */
523
522
    fail: function(msg, e) {
524
 
        var instance = this;
525
 
        instance.log(msg, "error"); // don't scrub this one
526
 
 
527
523
        if (this.config.throwFail) {
528
 
            throw e || new Error(msg);
 
524
            throw (e || new Error(msg)); 
 
525
        } else {
 
526
            var instance = this;
 
527
            instance.log(msg, "error"); // don't scrub this one
529
528
        }
530
529
 
531
530
        return this;
576
575
 
577
576
    // inheritance utilities are not available yet
578
577
    for (i in p) {
579
 
        if (true) { // hasOwnProperty not available yet and not needed
 
578
        if (true) {
580
579
            Y[i] = p[i];
581
580
        }
582
581
    }
592
591
 * @submodule yui-base
593
592
 */
594
593
// This is just a stub to for dependency processing
595
 
YUI.add("yui-base", null, "3.0.0pr1");
 
594
YUI.add("yui-base", null, "3.0.0pr2");
596
595
/*
597
596
 * YUI console logger
598
597
 * @module yui
603
602
    /**
604
603
     * If the 'debug' config is true, a 'yui:log' event will be
605
604
     * dispatched, which the logger widget and anything else
606
 
     * can consume.  If the 'useConsole' config is true, it will
 
605
     * can consume.  If the 'useBrowserConsole' config is true, it will
607
606
     * write to the browser console if available.
608
607
     *
609
608
     * @method log
613
612
     *                        categories are "info", "warn", "error", time".
614
613
     *                        Custom categories can be used as well. (opt)
615
614
     * @param  {String}  src  The source of the the message (opt)
 
615
     * @param  {boolean} silent If true, the log event won't fire
616
616
     * @return {YUI}      YUI instance
617
617
     */
618
 
    instance.log = function(msg, cat, src) {
 
618
    instance.log = function(msg, cat, src, silent) {
619
619
 
620
620
        var Y = instance, c = Y.config, es = Y.Env._eventstack,
621
 
            bail = (es && es.logging);
 
621
            // bail = (es && es.logging);
 
622
            bail = false; 
622
623
 
623
624
        // suppress log message if the config is off or the event stack
624
625
        // or the event call stack contains a consumer of the yui:log event
642
643
 
643
644
            if (!bail) {
644
645
 
645
 
                if (c.useConsole && typeof console != 'undefined') {
646
 
                        var f = (cat && console[cat]) ? cat : 'log',
647
 
                            m = (src) ? src + ': ' + msg : msg;
 
646
                if (c.useBrowserConsole) {
 
647
                    var m = (src) ? src + ': ' + msg : msg;
 
648
                    if (typeof console != 'undefined') {
 
649
                        var f = (cat && console[cat]) ? cat : 'log';
648
650
                        console[f](m);
 
651
                    } else if (typeof opera != 'undefined') {
 
652
                        opera.postError(m);
 
653
                    }
649
654
                }
650
655
 
651
 
                if (Y.fire && !bail) {
 
656
                if (Y.fire && !bail && !silent) {
652
657
                    Y.fire('yui:log', msg, cat, src);
653
658
                }
654
659
            }
657
662
        return Y;
658
663
    };
659
664
 
660
 
}, "3.0.0pr1");
 
665
}, "3.0.0pr2");
661
666
/*
662
667
 * YUI lang utils
663
668
 * @module yui
672
677
     */
673
678
    Y.Lang = Y.Lang || {};
674
679
 
675
 
    var L = Y.Lang, SPLICE="splice", LENGTH="length";
 
680
    var L = Y.Lang, 
 
681
 
 
682
    ARRAY_TOSTRING = '[object Array]',
 
683
    FUNCTION_TOSTRING = '[object Function]',
 
684
    STRING = 'string',
 
685
    OBJECT = 'object',
 
686
    BOOLEAN = 'boolean',
 
687
    UNDEFINED = 'undefined',
 
688
    OP = Object.prototype;
676
689
 
677
690
    /**
678
691
     * Determines whether or not the provided object is an array.
687
700
     * @param o The object to test
688
701
     * @return {boolean} true if o is an array
689
702
     */
690
 
     L.isArray = function(o) { 
691
 
        if (o) {
692
 
           //return L.isNumber(o.length) && L.isFunction(o.splice);
693
 
           return (o[SPLICE] && L.isNumber(o[LENGTH]));
694
 
        }
695
 
        return false;
 
703
    L.isArray = function(o) { 
 
704
        return OP.toString.apply(o) === ARRAY_TOSTRING;
696
705
    };
697
706
 
698
707
    /**
703
712
     * @return {boolean} true if o is a boolean
704
713
     */
705
714
    L.isBoolean = function(o) {
706
 
        return typeof o === 'boolean';
 
715
        return typeof o === BOOLEAN;
707
716
    };
708
717
    
709
718
    /**
710
719
     * Determines whether or not the provided object is a function
 
720
     * Note: Internet Explorer thinks certain functions are objects:
 
721
     *
 
722
     * var obj = document.createElement("object");
 
723
     * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
 
724
     *
 
725
     * var input = document.createElement("input"); // append to body
 
726
     * Y.Lang.isFunction(input.focus) // reports false in IE
 
727
     *
 
728
     * You will have to implement additional tests if these functions
 
729
     * matter to you.
 
730
     *
711
731
     * @method isFunction
712
732
     * @static
713
733
     * @param o The object to test
714
734
     * @return {boolean} true if o is a function
715
735
     */
716
736
    L.isFunction = function(o) {
717
 
        return typeof o === 'function';
 
737
        return OP.toString.apply(o) === FUNCTION_TOSTRING;
718
738
    };
719
739
        
720
740
    /**
760
780
     * @return {boolean} true if o is an object
761
781
     */  
762
782
    L.isObject = function(o, failfn) {
763
 
return (o && (typeof o === 'object' || (!failfn && L.isFunction(o)))) || false;
 
783
return (o && (typeof o === OBJECT || (!failfn && L.isFunction(o)))) || false;
764
784
    };
765
785
        
766
786
    /**
771
791
     * @return {boolean} true if o is a string
772
792
     */
773
793
    L.isString = function(o) {
774
 
        return typeof o === 'string';
 
794
        return typeof o === STRING;
775
795
    };
776
796
        
777
797
    /**
782
802
     * @return {boolean} true if o is undefined
783
803
     */
784
804
    L.isUndefined = function(o) {
785
 
        return typeof o === 'undefined';
 
805
        return typeof o === UNDEFINED;
786
806
    };
787
807
    
788
808
    /**
815
835
return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
816
836
    };
817
837
 
818
 
}, "3.0.0pr1");
 
838
}, "3.0.0pr2");
819
839
 
820
840
 
821
841
/*
860
880
     */
861
881
    Y.Array = function(o, i, al) {
862
882
        var t = (al) ? 2 : Y.Array.test(o);
863
 
        switch (t) {
864
 
            case 1:
865
 
                return (i) ? o.slice(o, i) : o;
866
 
            case 2:
867
 
                return Native.slice.call(o, i || 0);
868
 
            default:
869
 
                return [o];
 
883
 
 
884
        // switch (t) {
 
885
        //     case 1:
 
886
        //         // return (i) ? o.slice(i) : o;
 
887
        //     case 2:
 
888
        //         return Native.slice.call(o, i || 0);
 
889
        //     default:
 
890
        //         return [o];
 
891
        // }
 
892
 
 
893
        if (t) {
 
894
            return Native.slice.call(o, i || 0);
 
895
        } else {
 
896
            return [o];
870
897
        }
 
898
 
871
899
    };
872
900
 
873
901
    var A = Y.Array;
896
924
            } else {
897
925
                try {
898
926
                    // indexed, but no tagName (element) or alert (window)
899
 
                    if ("length" in o && !("tagName" in o)  && !("alert" in o)) {
900
 
                        r = 2;
 
927
                    if ("length" in o && 
 
928
                        !("tagName" in o) && 
 
929
                        !("alert" in o) && 
 
930
                        (!Y.Lang.isFunction(o.size) || o.size() > 1)) {
 
931
                            r = 2;
901
932
                    }
902
933
                        
903
934
                } catch(ex) {}
909
940
    /**
910
941
     * Executes the supplied function on each item in the array.
911
942
     * @method Array.each
 
943
     * @param a {Array} the array to iterate
 
944
     * @param f {Function} the function to execute on each item
 
945
     * @param o Optional context object
912
946
     * @static
913
947
     * @return {YUI} the YUI instance
914
948
     */
926
960
        };
927
961
 
928
962
    /**
 
963
     * Executes the supplied function on each item in the array.
 
964
     * Returning true from the processing function will stop the 
 
965
     * processing of the remaining
 
966
     * items.
 
967
     * @method Array.some
 
968
     * @param a {Array} the array to iterate
 
969
     * @param f {Function} the function to execute on each item
 
970
     * @param o Optional context object
 
971
     * @static
 
972
     * @return {boolean} true if the 
 
973
     */
 
974
     A.some = (Native.forEach) ?
 
975
        function (a, f, o) { 
 
976
            Native.some.call(a, f, o || Y);
 
977
            return Y;
 
978
        } :
 
979
        function (a, f, o) {
 
980
            var l = a.length;
 
981
            for (var i = 0; i < l; i=i+1) {
 
982
                if (f.call(o, a[i], i, a)) {
 
983
                    return true;
 
984
                }
 
985
            }
 
986
            return false;
 
987
        };
 
988
 
 
989
    /**
929
990
     * Returns an object using the first array as keys, and
930
991
     * the second as values.  If the second array is not
931
992
     * provided the value is set to true for each.
966
1027
        return -1;
967
1028
    };
968
1029
 
969
 
}, "3.0.0pr1");
 
1030
}, "3.0.0pr2");
970
1031
/*
971
1032
 * YUI core utilities
972
1033
 * @module yui
1068
1129
 
1069
1130
                for (var i in fs) { 
1070
1131
 
1071
 
                    // We never want to overwrite the prototype
1072
 
                    // if (PROTO === i) {
1073
 
                    if (PROTO === i || '_yuid' === i) {
1074
 
                        continue;
1075
 
                    }
1076
 
 
1077
 
                    // Y.log('i: ' + i + ", " + fs[i]);
1078
 
                    // @TODO deal with the hasownprop issue
1079
 
 
1080
 
                    // check white list if it was supplied
1081
 
                    if (!w || iwl || (i in w)) {
1082
 
                        // if the receiver has this property, it is an object,
1083
 
                        // and merge is specified, merge the two objects.
1084
 
                        if (m && L.isObject(fr[i], true)) {
1085
 
                            // console.log('aggregate RECURSE: ' + i);
1086
 
                            // @TODO recursive or no?
1087
 
                            // Y.mix(fr[i], fs[i]); // not recursive
1088
 
                            f(fr[i], fs[i], proto, true); // recursive
1089
 
                        // otherwise apply the property only if overwrite
1090
 
                        // is specified or the receiver doesn't have one.
1091
 
                        // @TODO make sure the 'arr' check isn't desructive
1092
 
                        } else if (!arr && (ov || !(i in fr))) {
1093
 
                            // console.log('hash: ' + i);
1094
 
                            fr[i] = fs[i];
1095
 
                        // if merge is specified and the receiver is an array,
1096
 
                        // append the array item
1097
 
                        } else if (arr) {
1098
 
                            // console.log('array: ' + i);
1099
 
                            // @TODO probably will need to remove dups
1100
 
                            fr.push(fs[i]);
 
1132
                    if (fs.hasOwnProperty(i)) {
 
1133
 
 
1134
                        // We never want to overwrite the prototype
 
1135
                        // if (PROTO === i) {
 
1136
                        if (PROTO === i || '_yuid' === i) {
 
1137
                            continue;
 
1138
                        }
 
1139
 
 
1140
                        // Y.log('i: ' + i + ", " + fs[i]);
 
1141
                        // @TODO deal with the hasownprop issue
 
1142
 
 
1143
                        // check white list if it was supplied
 
1144
                        if (!w || iwl || (i in w)) {
 
1145
                            // if the receiver has this property, it is an object,
 
1146
                            // and merge is specified, merge the two objects.
 
1147
                            if (m && L.isObject(fr[i], true)) {
 
1148
                                // console.log('aggregate RECURSE: ' + i);
 
1149
                                // @TODO recursive or no?
 
1150
                                // Y.mix(fr[i], fs[i]); // not recursive
 
1151
                                f(fr[i], fs[i], proto, true); // recursive
 
1152
                            // otherwise apply the property only if overwrite
 
1153
                            // is specified or the receiver doesn't have one.
 
1154
                            // @TODO make sure the 'arr' check isn't desructive
 
1155
                            } else if (!arr && (ov || !(i in fr))) {
 
1156
                                // console.log('hash: ' + i);
 
1157
                                fr[i] = fs[i];
 
1158
                            // if merge is specified and the receiver is an array,
 
1159
                            // append the array item
 
1160
                            } else if (arr) {
 
1161
                                // console.log('array: ' + i);
 
1162
                                // @TODO probably will need to remove dups
 
1163
                                fr.push(fs[i]);
 
1164
                            }
1101
1165
                        }
1102
1166
                    }
1103
1167
                }
1130
1194
 
1131
1195
    
1132
1196
 
1133
 
}, "3.0.0pr1");
 
1197
}, "3.0.0pr2");
1134
1198
/*
1135
1199
 * YUI object utilities
1136
1200
 * @module yui
1219
1283
        }
1220
1284
        return Y;
1221
1285
    };
1222
 
}, "3.0.0pr1");
 
1286
}, "3.0.0pr2");
1223
1287
/*
1224
1288
 * YUI user agent detection
1225
1289
 * @module yui
1357
1421
        
1358
1422
        return o;
1359
1423
    }();
1360
 
}, "3.0.0pr1");
 
1424
}, "3.0.0pr2");
1361
1425
/*
1362
1426
 * YUI setTimeout/setInterval abstraction
1363
1427
 * @module yui
1426
1490
    Y.later = later;
1427
1491
    L.later = later;
1428
1492
 
1429
 
}, "3.0.0pr1");
 
1493
}, "3.0.0pr2");
1430
1494
/*
1431
1495
 * YUI initializer
1432
1496
 * @module yui
1462
1526
 
1463
1527
    };
1464
1528
     
1465
 
    YUI.add("yui", M, "3.0.0pr1");
 
1529
    YUI.add("yui", M, "3.0.0pr2");
1466
1530
    
1467
1531
    // {
1468
1532
        // the following will be bound automatically when this code is loaded