简体   繁体   English

仅在IE11中未定义Javascript函数

[英]Javascript function is undefined only in IE11

I'm trying to use a template but just realized that the javascript doesn't work at all in IE. 我正在尝试使用模板,但只是意识到javascript在IE中根本无法使用。

It fails in several places but here is the first one: 它在几个地方失败,但这是第一个:

I have this tag, immediately before my </html> : 我在</html>之前有这个标签:

<script>
    document.addEventListener("DOMContentLoaded", function (event) {
        navbarToggleSidebar();
        navActivePage();
    });
</script>

The exception says, "0x800a1391 - JavaScript runtime error: 'navbarToggleSidebar' is undefined occurred" 异常显示“ 0x800a1391-JavaScript运行时错误:'navbarToggleSidebar'未定义”

The javascript file that came with this template was minimized as uses some cracy javascript markup that I've never seen and do not understand. 随模板一起使用的javascript文件已被最小化,因为它使用了一些我从未见过且无法理解的cracy javascript标记。 But when I do a find in the whole solution for navbarToggleSidebar I only find this: 但是,当我在navbarToggleSidebar的整个解决方案中进行查找时,只会发现以下内容:

JkW7: function (t, e, n) {
            "use strict";
            Object.defineProperty(e, "__esModule", {
                value: !0
            });
            var i = (n("PExH"), n("juYr"), n("6wzU"), n("e9iq"), n("aWFY"));
            ! function (t) {
                t.keys().map(t)
            }(n("pax0")), Object.assign(window, {
                masonryBuild: i.a,
                navbarToggleSidebar: i.c,
                navActivePage: i.b
            })
        },

I can post the whole file somewhere (just tell me where, it's too long to paste here) if that's helpful because this is clearly just a piece of a huge js thing that I don't understand at all. 我可以将整个文件发布到某个地方(只是告诉我,在这里粘贴太久了)是否有帮助,因为这显然只是我完全不了解的一件巨大的js事情。 I like to think I'm fairly decent with js and jquery and this looks greek to me. 我想认为我对js和jquery相当满意,这对我来说看起来很希腊。 And it all works beautifully in Chrome and FF. 在Chrome和FF中,它们都能完美地运行。

Can anyone help me figure out what's going on? 谁能帮我弄清楚发生了什么事?

Thanks!! 谢谢!!

Well n is a callback function t is an array or a list of some kind most likely; n是回调函数,t是最可能的数组或某种列表; so in order for you to figure out what is actually happening in the function you have to figure out where the function was actually invoked. 因此,为了弄清楚函数中实际发生的情况,您必须弄清楚函数在何处被实际调用。 It is much easier to find out what library was used and see if it is hosted anywhere in a non-minified version. 找出使用了什么库并查看它是否以非最小版本托管在任何地方都容易得多。 Sometimes this is done intentionally in order to protect developers from other people having an easy time engineering their solutions to programming problems. 有时这样做是有意进行的,目的是保护开发人员免受其他人的困扰,因为他们可以轻松地为编程问题设计解决方案。 Basically in order for anyone to figure out what the function actually does, you would have to print the entire page library, then trace through it, then when you are done after about a month you will have your answer. 基本上,为了使任何人都可以弄清楚该函数的实际作用,您将必须打印整个页面库,然后进行跟踪,然后在一个月后完成操作,您将得到答案。 Arrays, callback functions, as well as a probably system variable and object literals are used in that function. 该函数使用数组,回调函数以及可能的系统变量和对象常量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM