【问题标题】:Uncaught TypeError: X[g].exec is not a function fb tokenize未捕获的类型错误:X[g].exec 不是函数 fb tokenize
【发布时间】:2015-07-06 03:48:20
【问题描述】:

从今天开始,我收到如下错误:

Uncaught TypeError: X[g].exec is not a function fb tokenize

这是堆栈跟踪:

Uncaught TypeError: X[g].exec is not a function fb.tokenize @ jquery.min.js:2 fb.compile @ jquery.min.js:2 fb.select @ jquery.min.js:2 fb @ jquery.min.js:2 m.event.handlers @ jquery.min.js:3 m.event.dispatch @ jquery.min.js:3 r.handle @ jquery.min.js:3

该项目是在 .NET MVC 区域中构建的 Angularjs 应用程序。 依赖项是:

编辑

似乎是 Bootstrap.js 文件的问题,其中应该解除警报但未找到。 JQuery Sizzle 找不到"[alert-dismiss]"。 fb 是 JQuery 缩小版中的 Sizzle。

【问题讨论】:

  • 我建议您在此处了解更多关于究竟是什么问题的信息。解决此问题的一种方法是不使用开发/测试设置中涉及的代码的缩小版本,并在适当的地方包含调试符号。
  • 我认为它对你有用.. enter link description here

标签: angularjs twitter-bootstrap angular-ui-bootstrap typeerror toastr


【解决方案1】:

我找到了罪魁祸首。

bootstrap.js 和 angular bootstrap ui 库的组合似乎对力量产生了干扰。删除不必要的 bootstrap.js 后一切正常。

【讨论】:

    【解决方案2】:

    我有同样的X[g].exec is not a function 错误,在我的情况下,这是因为我定义了一个Object.prototype.count 函数。

    【讨论】:

    • 我有过类似的经历,这让我明白了——不要扩展对象原型。它会弄乱 jQuery(我敢打赌 Gecko IT 的解决方案是因为 bootstrap 扩展了 Object)。
    【解决方案3】:

    要解决这个问题,请将以下内容添加到您的代码中:

    Function.prototype.exec = Object.prototype.exec = function() {return null};
    

    【讨论】:

      【解决方案4】:

      就我而言,我试图获取非索引数组的索引来迭代它。代码是:

      Object.prototype.getByIndex = function(index) {
          return this[Object.keys(this)[index]];
        };
      

      this 关键字代表我试图获取索引的数据。所以使用它是:

      // ...
      const element = groupedData.getByIndex(index);
      // ...
      

      为了解决这个问题,我将其修改为常规函数,然后将数据作为参数传递。新函数如下所示:

      function getByIndex(grupData, index) {
          return grupData[Object.keys(grupData)[index]];
        };
      

      并传递数据:

      const element = getByIndex(groupedData, index);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-11-19
        • 1970-01-01
        • 2019-06-06
        • 2019-05-24
        • 2021-12-15
        • 2019-10-26
        • 2016-06-27
        相关资源
        最近更新 更多