需要IE8问题

时间:2014-10-23 09:51:30

标签: javascript jquery internet-explorer internet-explorer-8 requirejs

您好我们在IE8中遇到了ReuqireJS的问题。下面是我们的代码,我们在IE8中收到错误,说明Object不支持以下行中的此属性或方法:require(['/Content/themes/base/js/pages/all_pages/all_pages.js?t=' + Date.now()], function (views)

请注意IE8可能没有报告正确的行?

我已经阅读了有关使用shim的问题,但我们正在使用jquery-1.10.2-min库。

任何人都可以看到IE9中的任何问题 - IE11和所有其他浏览器都可以正常工作吗?

任何帮助都将不胜感激。

require.config(
{
    //waitSeconds: 20,
    baseUrl: '/Content/themes/base/',
    paths: {
        'jquery': 'js/vendor/jquery/jquery-1.10.2-min',
    'underscore': 'js/vendor/underscore/underscore.min',
    'backbone': 'js/vendor/backbone/backbone.min',
    'backboneNesting': 'js/vendor/backbone/backbone-nesting',
    'jQueryUi': 'js/vendor/jquery/jquery-ui-1.11.0.min',
    'flot': 'js/vendor/jquery/jquery.flot',
    'templates': 'templates',
    'validate': 'js/vendor/jquery/jquery.validate.min',
    'validateUnobtrusive': 'js/vendor/jquery/jquery.validate.unobtrusive.min',
    'bootstrap': 'js/vendor/bootstrap/bootstrap.min',
    'pwstrength': 'js/vendor/bootstrap/pwstrength-bootstrap-1.1.2.min',
    'mCustomScrollbar': 'js/vendor/jquery/jquery.mCustomScrollbar.concat.min',
    'main': 'js/vendor/x/main.js',
    'async': 'js/vendor/x/zxcvbn-async.js',
    'validatePassword': 'js/vendor/jquery/jquery.validate.password',
    'select2': 'js/vendor/x/select2.min',
    'bootstrap-datepicker': 'js/vendor/bootstrap/bootstrap-datepicker',
    'flot-resize': 'js/vendor/jquery/jquery.ba-resize',
    'unobtrusive': 'js/vendor/jquery/jquery.unobtrusive-ajax',
    'flot-navigate': 'js/vendor/jquery/jquery.flot.navigate',
    'flot-time': 'js/vendor/jquery/jquery.flot.time', 
    'flot-orderBars': 'js/vendor/jquery/jquery.flot.orderBars'
},
    shim: {
          'jquery': { exports: '$' }
        , 'underscore': { exports: '_', deps: ['jquery'] }
        , 'backbone': { exports: 'Backbone', deps: ['underscore'] }
        , 'backboneNesting': { deps: ['backbone'] }
        , 'jQueryUi': { deps: ['jquery'] }
        , 'flot': { deps: ['jquery'] }
        , 'flot-resize': { deps: ['jquery', 'flot'], exports: "$" }
        , 'flot-navigate': { deps: ['jquery', 'flot'] }
        , 'flot-time': { deps: ['jquery', 'flot'] }
        , 'flot-orderBars': { deps: ['jquery', 'flot'] }
        //,'widgets': { deps: ['backbone'] }
        , 'validate': { deps: ['jquery'] }
        , 'validateUnobtrusive': { deps: ['validate'] }
        , 'bootstrap': { deps: ['jQueryUi'] }
        , 'bootstrap-datepicker': { deps: ['bootstrap'] }
        , 'pwstrength': { deps: ['bootstrap'] }
        , 'mCustomScrollbar': { deps: ['jquery'] }
        , 'validatePassword': { deps: ['jquery'] }
        , 'select2': { deps: ['jquery'], exports: "$" }
        , 'unobtrusive': { deps: ['jquery'] }
    }
});

require(['jquery', 'select2'], function ($) {

    $('.select2').select2({ width: 'resolve' });
    $('.select2-nosearch').select2({ minimumResultsForSearch: -1, width: 'resolve' });

    $('.header .controls').show();
    $('.header .dropdown').show();
    //console.log('jQuery version:', $.fn.jquery);
    // jQuery and other depandancies loaded, call the rest.
    require([
          'underscore', 'backbone', 'bootstrap', 'jQueryUi', 'mCustomScrollbar'
        , '/Content/themes/base/js/vendor/canvas/html2canvas.js'
        , '/Content/themes/base/js/vendor/jquery/jquery.plugin.html2canvas.js'
        , '/Content/themes/base/js/vendor/canvas/excanvas.min.js'
        , 'unobtrusive'
        ], function () {
            require(['/Content/themes/base/js/pages/all_pages/all_pages.js?t=' + Date.now()], function (views) {
                //console.log('(app.js) views', views);
                // get current page location.
                var page = window.location.href.toString().split(window.location.host)[1].split("?")[0].split("#")[0].toLowerCase();
                // remove any index referances.
                page = page.replace('/index', '');
                // remove any trailing slashes.
                if (page.substr(-1) == '/') {
                    page = page.substr(0, page.length - 1);
                }
                // add alias's for default pages.
                if (page === '' || page === '/overview') {
                    page = '/overview/index';
                }
                // add alias's for default energy pages.
                if (page === '/energy') {
                    page = '/energy/dashboard';
                }
                page += ('.js?t=' + Date.now());
                //console.log('/Content/themes/base/js/pages' + page);
                require(['/Content/themes/base/js/pages' + page]);
            });
        });
    if (document.documentMode) {
        // ie.
        if (document.documentMode === 9) {
            //console.log('IE 9');
            require(['/Content/themes/base/js/vendor/pie/PIE']);
        } else if (document.documentMode === 11) {
            //console.log('IE 11');
        }
    }
});

0 个答案:

没有答案