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

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/loader/loader.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
 * Loader dynamically loads script and css files.  It includes the dependency
130
130
    CSSBASE = 'cssbase',
131
131
    CSS_AFTER = [CSSRESET, CSSFONTS, CSSGRIDS, 'cssreset-context', 'cssfonts-context', 'cssgrids-context'],
132
132
    YUI_CSS = ['reset', 'fonts', 'grids', 'base'],
133
 
    VERSION = '3.0.0pr1',
 
133
    VERSION = '3.0.0pr2',
134
134
    ROOT = VERSION + '/build/',
135
135
    CONTEXT = '-context',
136
136
    META = {
143
143
 
144
144
    comboBase: 'http://yui.yahooapis.com/combo?',
145
145
 
 
146
    skin: {
 
147
        defaultSkin: 'sam',
 
148
        base: 'assets/skins/',
 
149
        path: 'skin.css',
 
150
        after: ['reset', 'fonts', 'grids', 'base']
 
151
        //rollup: 3
 
152
    },
 
153
 
146
154
    modules: {
147
155
 
148
156
       dom: {
175
183
                },
176
184
                'node-screen': {
177
185
                    requires: ['dom-screen', 'node-base']
 
186
                },
 
187
                'node-event-simulate': {
 
188
                    requires: ['node-base']
178
189
                }
179
190
            }
180
191
        },
214
225
        },
215
226
        
216
227
        compat: { 
217
 
            requires: ['node']
 
228
            requires: ['node', 'dump', 'substitute']
 
229
        },
 
230
 
 
231
        classnamemanager: { },
 
232
 
 
233
        console: {
 
234
            requires: ['widget', 'substitute'],
 
235
            skinnable: true
218
236
        },
219
237
        
220
238
        cookie: { },
229
247
        //     optional: [CSSRESET]
230
248
        // },
231
249
 
232
 
        'dd':{
 
250
        dd:{
233
251
            submodules: {
234
252
                'dd-ddm-base': {
235
253
                    requires: ['node', BASE]
268
286
            requires: ['oop']
269
287
        },
270
288
 
271
 
        get: { },
 
289
        get: { 
 
290
            requires: ['yui-base']
 
291
        },
272
292
        
273
 
        io: { 
274
 
            requires: ['node']
 
293
        io:{
 
294
            submodules: {
 
295
 
 
296
                'io-base': {
 
297
                    requires: ['node']
 
298
                }, 
 
299
 
 
300
                'io-xdr': {
 
301
                    requires: ['io-base']
 
302
                }, 
 
303
 
 
304
                'io-form': {
 
305
                    requires: ['io-base']
 
306
                }, 
 
307
 
 
308
                'io-upload-iframe': {
 
309
                    requires: ['io-base']
 
310
                },
 
311
 
 
312
                'io-queue': {
 
313
                    requires: ['io-base']
 
314
                }
 
315
            }
275
316
        },
276
317
 
277
318
        json: {
284
325
            }
285
326
        },
286
327
 
287
 
        loader: { },
 
328
        loader: { 
 
329
            requires: ['get']
 
330
        },
 
331
 
 
332
        'node-menunav': {
 
333
            requires: ['node', 'classnamemanager'],
 
334
            skinnable: true
 
335
        },
288
336
        
289
337
        oop: { 
290
338
            requires: ['yui-base']
291
339
        },
292
340
 
293
 
        queue: { },
 
341
        overlay: {
 
342
            requires: ['widget', 'widget-position', 'widget-position-ext', 'widget-stack', 'widget-stdmod'],
 
343
            skinnable: true
 
344
        },
 
345
 
 
346
        plugin: { 
 
347
            requires: ['base']
 
348
        },
 
349
 
 
350
        profiler: { },
 
351
 
 
352
        queue: {
 
353
            requires: ['node']
 
354
        },
 
355
 
 
356
        slider: {
 
357
            requires: ['widget', 'dd-constrain'],
 
358
            skinnable: true
 
359
        },
 
360
 
 
361
        stylesheet: { },
294
362
 
295
363
        substitute: {
296
364
            optional: ['dump']
297
365
        },
298
366
 
 
367
        widget: {
 
368
            requires: ['base', 'node', 'classnamemanager'],
 
369
            plugins: {
 
370
                'widget-position': { },
 
371
                'widget-position-ext': {
 
372
                    requires: ['widget-position']
 
373
                },
 
374
                'widget-stack': {
 
375
                    skinnable: true
 
376
                },
 
377
                'widget-stdmod': { }
 
378
            },
 
379
            skinnable: true
 
380
        },
 
381
 
299
382
        // Since YUI is required for everything else, it should not be specified as
300
383
        // a dependency.
301
384
        yui: {
302
385
            supersedes: ['yui-base', 'get', 'loader']
303
386
        },
304
387
 
305
 
        'yui-base': { }
 
388
        'yui-base': { },
 
389
 
 
390
        yuitest: {                                                                                                                                                        
 
391
            requires: ['substitute', 'node', 'json']                                                                                                                     
 
392
        }  
 
393
 
306
394
    }
307
395
};
308
396
 
538
626
         */
539
627
        // this.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
540
628
        this.moduleInfo = {};
 
629
 
 
630
        /**
 
631
         * Provides the information used to skin the skinnable components.
 
632
         * The following skin definition would result in 'skin1' and 'skin2'
 
633
         * being loaded for calendar (if calendar was requested), and
 
634
         * 'sam' for all other skinnable components:
 
635
         *
 
636
         *   <code>
 
637
         *   skin: {
 
638
         *
 
639
         *      // The default skin, which is automatically applied if not
 
640
         *      // overriden by a component-specific skin definition.
 
641
         *      // Change this in to apply a different skin globally
 
642
         *      defaultSkin: 'sam', 
 
643
         *
 
644
         *      // This is combined with the loader base property to get
 
645
         *      // the default root directory for a skin. ex:
 
646
         *      // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
 
647
         *      base: 'assets/skins/',
 
648
         *
 
649
         *      // The name of the rollup css file for the skin
 
650
         *      path: 'skin.css',
 
651
         *
 
652
         *      // The number of skinnable components requested that are
 
653
         *      // required before using the rollup file rather than the
 
654
         *      // individual component css files
 
655
         *      rollup: 3,
 
656
         *
 
657
         *      // Any component-specific overrides can be specified here,
 
658
         *      // making it possible to load different skins for different
 
659
         *      // components.  It is possible to load more than one skin
 
660
         *      // for a given component as well.
 
661
         *      overrides: {
 
662
         *          calendar: ['skin1', 'skin2']
 
663
         *      }
 
664
         *   }
 
665
         *   </code>
 
666
         *   @property skin
 
667
         */
 
668
         this.skin = Y.merge(Y.Env.meta.skin);
541
669
        
542
670
        var defaults = Y.Env.meta.modules;
543
671
 
607
735
 
608
736
        this.skipped = {};
609
737
 
 
738
 
610
739
        // Y.on('yui:load', this.loadNext, this);
611
740
 
612
741
        this._config(o);
626
755
            }
627
756
        },
628
757
 
 
758
        SKIN_PREFIX: "skin-",
 
759
 
629
760
        _config: function(o) {
630
761
 
631
762
            // apply config values
632
763
            if (o) {
633
764
                for (var i in o) {
634
 
                    var val = o[i];
635
765
                    if (o.hasOwnProperty(i)) {
 
766
                        var val = o[i];
636
767
                        if (i == 'require') {
637
768
                            this.require(val);
638
 
                        // support the old callback syntax
639
 
                        // } else if (i.indexOf('on') === 0) {
640
 
                            // this.subscribe(i.substr(2).toLowerCase(), o[i], o.context || this);
641
769
                        } else if (i == 'modules') {
 
770
 
642
771
                            // add a hash of module definitions
643
772
                            for (var j in val) {
644
 
                                this.addModule(val[j], j);
 
773
                                if (val.hasOwnProperty(j)) {
 
774
                                    this.addModule(val[j], j);
 
775
                                }
645
776
                            }
 
777
 
646
778
                        } else {
647
779
                            this[i] = val;
648
780
                        }
654
786
            var f = this.filter;
655
787
 
656
788
            if (L.isString(f)) {
657
 
 
658
789
                f = f.toUpperCase();
659
 
 
660
790
                this.filterName = f;
661
 
 
662
 
                // the logger must be available in order to use the debug
663
 
                // versions of the library
664
 
                // @TODO review when logreader is available
665
 
                // if (f === "DEBUG") {
666
 
                //     this.require("log");
667
 
                // }
668
 
 
669
791
                this.filter = this.FILTERS[f];
670
792
            }
671
793
 
672
794
        },
673
795
 
 
796
        /**
 
797
         * Returns the skin module name for the specified skin name.  If a
 
798
         * module name is supplied, the returned skin module name is 
 
799
         * specific to the module passed in.
 
800
         * @method formatSkin
 
801
         * @param skin {string} the name of the skin
 
802
         * @param mod {string} optional: the name of a module to skin
 
803
         * @return {string} the full skin module name
 
804
         */
 
805
        formatSkin: function(skin, mod) {
 
806
            var s = this.SKIN_PREFIX + skin;
 
807
            if (mod) {
 
808
                s = s + "-" + mod;
 
809
            }
 
810
 
 
811
            return s;
 
812
        },
 
813
 
 
814
        /**
 
815
         * Reverses <code>formatSkin</code>, providing the skin name and
 
816
         * module name if the string matches the pattern for skins.
 
817
         * @method parseSkin
 
818
         * @param mod {string} the module name to parse
 
819
         * @return {skin: string, module: string} the parsed skin name 
 
820
         * and module name, or null if the supplied string does not match
 
821
         * the skin pattern
 
822
         */
 
823
        parseSkin: function(mod) {
 
824
            
 
825
            if (mod.indexOf(this.SKIN_PREFIX) === 0) {
 
826
                var a = mod.split("-");
 
827
                return {skin: a[1], module: a[2]};
 
828
            } 
 
829
 
 
830
            return null;
 
831
        },
 
832
 
 
833
        /**
 
834
         * Adds the skin def to the module info
 
835
         * @method _addSkin
 
836
         * @param skin {string} the name of the skin
 
837
         * @param mod {string} the name of the module
 
838
         * @param parent {string} parent module if this is a skin of a
 
839
         * submodule or plugin
 
840
         * @return {string} the module name for the skin
 
841
         * @private
 
842
         */
 
843
        _addSkin: function(skin, mod, parent) {
 
844
 
 
845
            var name = this.formatSkin(skin), info = this.moduleInfo,
 
846
                sinf = this.skin, ext = info[mod] && info[mod].ext;
 
847
 
 
848
            /*
 
849
            // Add a module definition for the skin rollup css
 
850
            if (!info[name]) {
 
851
                this.addModule({
 
852
                    'name': name,
 
853
                    'type': 'css',
 
854
                    'path': sinf.base + skin + '/' + sinf.path,
 
855
                    //'supersedes': '*',
 
856
                    'after': sinf.after,
 
857
                    'rollup': sinf.rollup,
 
858
                    'ext': ext
 
859
                });
 
860
            }
 
861
            */
 
862
 
 
863
            // Add a module definition for the module-specific skin css
 
864
            if (mod) {
 
865
                name = this.formatSkin(skin, mod);
 
866
                if (!info[name]) {
 
867
                    var mdef = info[mod], pkg = mdef.pkg || mod;
 
868
                    this.addModule({
 
869
                        'name': name,
 
870
                        'type': 'css',
 
871
                        'after': sinf.after,
 
872
                        'path': (parent || pkg) + '/' + sinf.base + skin + '/' + mod + '.css',
 
873
                        'ext': ext
 
874
                    });
 
875
                }
 
876
            }
 
877
 
 
878
            return name;
 
879
        },
 
880
 
674
881
        /** Add a new module to the component metadata.         
675
882
         * <dl>
676
883
         *     <dt>name:</dt>       <dd>required, the component name</dd>
713
920
            o.requires = o.requires || [];
714
921
 
715
922
 
 
923
            this.moduleInfo[name] = o;
 
924
 
716
925
            // Handle submodule logic
717
 
            var subs = o.submodules;
 
926
            var subs = o.submodules, i;
718
927
            if (subs) {
719
928
                var sup = [], l=0;
720
929
 
721
 
                for (var i in subs) {
722
 
                    var s = subs[i];
723
 
                    s.path = _path(name, i, o.type);
724
 
                    this.addModule(s, i);
725
 
                    sup.push(i);
726
 
                    l++;
 
930
                for (i in subs) {
 
931
                    if (subs.hasOwnProperty(i)) {
 
932
                        var s = subs[i];
 
933
                        s.path = _path(name, i, o.type);
 
934
                        this.addModule(s, i);
 
935
                        sup.push(i);
 
936
 
 
937
                        if (o.skinnable) {
 
938
                            var smod = this._addSkin(this.skin.defaultSkin, i, name);
 
939
                            sup.push(smod.name);
 
940
                        }
 
941
 
 
942
                        l++;
 
943
                    }
727
944
                }
728
945
 
729
946
                o.supersedes = sup;
730
947
                o.rollup = Math.min(l-1, 4);
731
948
            }
732
949
 
733
 
            this.moduleInfo[name] = o;
 
950
            var plugins = o.plugins;
 
951
            if (plugins) {
 
952
                for (i in plugins) {
 
953
                    if (plugins.hasOwnProperty(i)) {
 
954
                        var plug = plugins[i];
 
955
                        plug.path = _path(name, i, o.type);
 
956
                        plug.requires = plug.requires || [];
 
957
                        plug.requires.push(name);
 
958
                        this.addModule(plug, i);
 
959
                        if (o.skinnable) {
 
960
                            this._addSkin(this.skin.defaultSkin, i, name);
 
961
                        }
 
962
                    }
 
963
                }
 
964
            }
 
965
 
734
966
            this.dirty = true;
735
967
 
736
968
            return o;
890
1122
 
891
1123
            var info = this.moduleInfo, name, i, j;
892
1124
 
 
1125
            // Create skin modules
 
1126
            for (name in info) {
 
1127
                if (info.hasOwnProperty(name)) {
 
1128
                    var m = info[name];
 
1129
                    if (m && m.skinnable) {
 
1130
                        var o=this.skin.overrides, smod;
 
1131
                        if (o && o[name]) {
 
1132
                            for (i=0; i<o[name].length; i=i+1) {
 
1133
                                smod = this._addSkin(o[name][i], name);
 
1134
                            }
 
1135
                        } else {
 
1136
                            smod = this._addSkin(this.skin.defaultSkin, name);
 
1137
                        }
 
1138
 
 
1139
                        m.requires.push(smod);
 
1140
                    }
 
1141
                }
 
1142
            }
 
1143
 
893
1144
            var l = Y.merge(this.inserted); // shallow clone
894
1145
 
895
1146
            // available modules
996
1247
                // go through the rollup candidates
997
1248
                for (i in rollups) { 
998
1249
 
999
 
                    // there can be only one
1000
 
                    if (!r[i] && !this.loaded[i]) {
1001
 
                        m =this.getModule(i); s = m.supersedes ||[]; roll=false;
1002
 
 
1003
 
                        if (!m.rollup) {
1004
 
                            continue;
1005
 
                        }
1006
 
 
1007
 
                        var c=0;
1008
 
 
1009
 
                        // check the threshold
1010
 
                        for (j=0;j<s.length;j=j+1) {
1011
 
 
1012
 
                            // if the superseded module is loaded, we can't load the rollup
1013
 
                            // if (this.loaded[s[j]] && (!_Y.dupsAllowed[s[j]])) {
1014
 
                            if (this.loaded[s[j]]) {
1015
 
                                roll = false;
1016
 
                                break;
1017
 
                            // increment the counter if this module is required.  if we are
1018
 
                            // beyond the rollup threshold, we will use the rollup module
1019
 
                            } else if (r[s[j]]) {
1020
 
                                c++;
1021
 
                                roll = (c >= m.rollup);
1022
 
                                if (roll) {
 
1250
                    if (rollups.hasOwnProperty(i)) {
 
1251
 
 
1252
                        // there can be only one
 
1253
                        if (!r[i] && !this.loaded[i]) {
 
1254
                            m =this.getModule(i); s = m.supersedes ||[]; roll=false;
 
1255
 
 
1256
                            if (!m.rollup) {
 
1257
                                continue;
 
1258
                            }
 
1259
 
 
1260
                            var c=0;
 
1261
 
 
1262
                            // check the threshold
 
1263
                            for (j=0;j<s.length;j=j+1) {
 
1264
 
 
1265
                                // if the superseded module is loaded, we can't load the rollup
 
1266
                                // if (this.loaded[s[j]] && (!_Y.dupsAllowed[s[j]])) {
 
1267
                                if (this.loaded[s[j]]) {
 
1268
                                    roll = false;
1023
1269
                                    break;
 
1270
                                // increment the counter if this module is required.  if we are
 
1271
                                // beyond the rollup threshold, we will use the rollup module
 
1272
                                } else if (r[s[j]]) {
 
1273
                                    c++;
 
1274
                                    roll = (c >= m.rollup);
 
1275
                                    if (roll) {
 
1276
                                        break;
 
1277
                                    }
1024
1278
                                }
1025
1279
                            }
1026
 
                        }
1027
 
 
1028
 
                        if (roll) {
1029
 
                            // add the rollup
1030
 
                            r[i] = true;
1031
 
                            rolled = true;
1032
 
 
1033
 
                            // expand the rollup's dependencies
1034
 
                            this.getRequires(m);
 
1280
 
 
1281
                            if (roll) {
 
1282
                                // add the rollup
 
1283
                                r[i] = true;
 
1284
                                rolled = true;
 
1285
 
 
1286
                                // expand the rollup's dependencies
 
1287
                                this.getRequires(m);
 
1288
                            }
1035
1289
                        }
1036
1290
                    }
1037
1291
                }
1054
1308
            var i, j, s, m, r=this.required;
1055
1309
            for (i in r) {
1056
1310
 
1057
 
                // remove if already loaded
1058
 
                if (i in this.loaded) { 
1059
 
                    delete r[i];
1060
 
 
1061
 
                // remove anything this module supersedes
1062
 
                } else {
1063
 
 
1064
 
                     m = this.getModule(i);
1065
 
                     s = m && m.supersedes;
1066
 
                     if (s) {
1067
 
                         for (j=0; j<s.length; j=j+1) {
1068
 
                             if (s[j] in r) {
1069
 
                                 delete r[s[j]];
 
1311
                if (r.hasOwnProperty(i)) {
 
1312
 
 
1313
                    // remove if already loaded
 
1314
                    if (i in this.loaded) { 
 
1315
                        delete r[i];
 
1316
 
 
1317
                    // remove anything this module supersedes
 
1318
                    } else {
 
1319
 
 
1320
                         m = this.getModule(i);
 
1321
                         s = m && m.supersedes;
 
1322
                         if (s) {
 
1323
                             for (j=0; j<s.length; j=j+1) {
 
1324
                                 if (s[j] in r) {
 
1325
                                     delete r[s[j]];
 
1326
                                 }
1070
1327
                             }
1071
1328
                         }
1072
 
                     }
 
1329
                    }
1073
1330
                }
1074
1331
            }
1075
1332
        },
1093
1350
 
1094
1351
            this._attach();
1095
1352
 
1096
 
            for (var i in this.skipped) {
1097
 
                delete this.inserted[i];
 
1353
            var skipped = this.skipped;
 
1354
 
 
1355
            for (var i in skipped) {
 
1356
                if (skipped.hasOwnProperty(i)) {
 
1357
                    delete this.inserted[i];
 
1358
                }
1098
1359
            }
1099
1360
 
1100
1361
            this.skipped = {};
1192
1453
                }
1193
1454
 
1194
1455
                // external css files should be sorted below yui css
1195
 
                if (mm.ext && mm.type == CSS && (!other.ext)) {
 
1456
                if (mm.ext && mm.type == CSS && !other.ext && other.type == CSS) {
1196
1457
                    return true;
1197
1458
                }
1198
1459
 
1281
1542
            // flag to indicate we are done with the combo service
1282
1543
            // and any additional files will need to be loaded
1283
1544
            // individually
1284
 
            this._combineComplete = false;
 
1545
            this._combineComplete = {};
1285
1546
 
1286
1547
            // keep the loadType (js, css or undefined) cached
1287
1548
            this.loadType = type;
1310
1571
                return;
1311
1572
            }
1312
1573
 
1313
 
            var s, len, i, m, url, self=this;
 
1574
            var s, len, i, m, url, self=this, type=this.loadType, fn;
1314
1575
 
1315
1576
            // @TODO this will need to handle the two phase insert when
1316
1577
            // CSS support is added
1317
 
            if (this.loadType !== CSS && this.combine && (!this._combineComplete)) {
 
1578
            if (this.combine && (!this._combineComplete[type])) {
1318
1579
 
1319
1580
                this._combining = []; 
1320
1581
                s=this.sorted;
1325
1586
                    m = this.getModule(s[i]);
1326
1587
// @TODO we can't combine CSS yet until we deliver files with absolute paths to the assets
1327
1588
                    // Do not try to combine non-yui JS
1328
 
                    if (m.type == JS && !m.ext) {
 
1589
                    if (m && m.type === this.loadType && !m.ext) {
1329
1590
                        url += this.root + m.path;
1330
1591
                        if (i < len-1) {
1331
1592
                            url += '&';
1339
1600
 
1340
1601
 
1341
1602
                    var callback=function(o) {
1342
 
                        this._combineComplete = true;
 
1603
                        this._combineComplete[type] = true;
1343
1604
 
1344
1605
 
1345
1606
                        var c=this._combining, len=c.length, i, m;
1350
1611
                        this.loadNext(o.data);
1351
1612
                    };
1352
1613
 
 
1614
                    fn =(type === CSS) ? Y.Get.css : Y.Get.script;
 
1615
 
1353
1616
                    // @TODO get rid of the redundant Get code
1354
 
                    Y.Get.script(url, {
 
1617
                    fn(this._filter(url), {
1355
1618
                        data: this._loading,
1356
1619
                        onSuccess: callback,
1357
1620
                        onFailure: this._onFailure,
1365
1628
                    return;
1366
1629
 
1367
1630
                } else {
1368
 
                    this._combineComplete = true;
 
1631
                    this._combineComplete[type] = true;
1369
1632
                }
1370
1633
            }
1371
1634
 
1435
1698
 
1436
1699
                // The load type is stored to offer the possibility to load
1437
1700
                // the css separately from the script.
1438
 
                if (!this.loadType || this.loadType === m.type) {
 
1701
                if (!type || type === m.type) {
1439
1702
                    this._loading = s[i];
1440
1703
 
1441
 
                    var fn=(m.type === CSS) ? Y.Get.css : Y.Get.script,
1442
 
                        onsuccess=function(o) {
 
1704
                    fn = (m.type === CSS) ? Y.Get.css : Y.Get.script;
 
1705
 
 
1706
                    var onsuccess=function(o) {
1443
1707
                            self.loadNext(o.data);
1444
1708
                        };
1445
1709
                        
1446
 
                    url=m.fullpath || this._url(m.path, s[i]);
1447
 
                    self=this; 
 
1710
                    url = (m.fullpath) ? this._filter(m.fullpath) : this._url(m.path, s[i]);
 
1711
 
 
1712
                    self = this; 
1448
1713
 
1449
1714
                    fn(url, {
1450
1715
                        data: s[i],
1464
1729
            // we are finished
1465
1730
            this._loading = null;
1466
1731
 
 
1732
            fn = this._internalCallback;
 
1733
 
1467
1734
            // internal callback for loading css first
1468
 
            if (this._internalCallback) {
1469
 
 
1470
 
                var f = this._internalCallback;
 
1735
            if (fn) {
1471
1736
                this._internalCallback = null;
1472
 
                f.call(this);
 
1737
                fn.call(this);
1473
1738
 
1474
1739
            // } else if (this.onSuccess) {
1475
1740
            } else {
1476
 
 
1477
1741
                // call Y.use passing this instance. Y will use the sorted
1478
1742
                // dependency list.
1479
 
 
1480
1743
                this._onSuccess();
1481
 
 
1482
1744
            }
1483
1745
 
1484
1746
        },
1497
1759
        },
1498
1760
 
1499
1761
        /**
1500
 
         * Generates the full url for a module
1501
 
         * method _url
1502
 
         * @param path {string} the path fragment
1503
 
         * @return {string} the full url
 
1762
         * Apply filter defined for this instance to a url/path
 
1763
         * method _filter
 
1764
         * @param u {string} the string to filter
 
1765
         * @return {string} the filtered string
1504
1766
         * @private
1505
1767
         */
1506
 
        _url: function(path, name) {
1507
 
            
1508
 
            var u = (this.base || "") + path, 
1509
 
                f = this.filter;
1510
 
 
1511
 
            if (f) {
 
1768
        _filter: function(u) {
 
1769
 
 
1770
 
 
1771
            var f = this.filter;
 
1772
 
 
1773
            if (u && f) {
1512
1774
                var useFilter = true;
1513
1775
 
1514
1776
                if (this.filterName == "DEBUG") {
1515
1777
                
1516
 
                    var self = this, 
1517
 
                        exc = self.logExclude,
1518
 
                        inc = self.logInclude;
 
1778
                    var exc = this.logExclude,
 
1779
                        inc = this.logInclude;
1519
1780
                    if (inc && !(name in inc)) {
1520
1781
                        useFilter = false;
1521
1782
                    } else if (exc && (name in exc)) {
1525
1786
                }
1526
1787
                
1527
1788
                if (useFilter) {
1528
 
                    u = u.replace(new RegExp(f.searchExp), f.replaceStr);
 
1789
                    u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
1529
1790
                }
1530
1791
            }
1531
1792
 
1532
 
 
1533
1793
            return u;
 
1794
 
 
1795
        },
 
1796
 
 
1797
        /**
 
1798
         * Generates the full url for a module
 
1799
         * method _url
 
1800
         * @param path {string} the path fragment
 
1801
         * @return {string} the full url
 
1802
         * @private
 
1803
         */
 
1804
        _url: function(path, name) {
 
1805
            return this._filter((this.base || "") + path);
1534
1806
        }
1535
1807
 
1536
1808
    };
1537
1809
 
1538
1810
    // Y.augment(Y.Loader, Y.Event.Target);
1539
1811
 
1540
 
}, "3.0.0pr1");
 
1812
}, "3.0.0pr2");