2

Since today I am getting an error as follows:

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

This is the stack trace:

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

The project is an Angularjs app built in an .NET MVC Area. Dependencies are:

Edit

Seems to be a problem with Bootstrap.js file, where an alert is supposed to be dismissed but not found. JQuery Sizzle can't find "[alert-dismiss]". The fb is Sizzle in minified version of JQuery.

Gecko
  • 1,333
  • 1
  • 14
  • 26
  • I recommend finding out more information about what exactly is broken here. One way do approach this would be to not use minified versions of the code involved in your development/testing setup, and include debug symbols wherever appropriate. – derabbink May 01 '15 at 10:31
  • 1
    i think it will work for you.. [enter link description here](https://stackoverflow.com/questions/21729895/jquery-conflict-with-native-prototype) – Sultan Belai Jun 04 '19 at 09:39

4 Answers4

18

I had the same X[g].exec is not a function error and in my case it was because i defined a Object.prototype.count function.

Quesstor
  • 262
  • 2
  • 8
  • 2
    I had a similar experience and it drives home the point - do not extend the Object prototype. It will mess up jQuery (I'm willing to bet Gecko IT's solution was because bootstrap extends the Object). – Rex the Strange Feb 22 '20 at 15:10
4

I found the culprit.

Seems there was a disturbance in the force with the combination of bootstrap.js and the angular bootstrap ui library. After removing the unnecessary bootstrap.js all was well.

Gecko
  • 1,333
  • 1
  • 14
  • 26
1

To solve that, add the following to your code:

Function.prototype.exec = Object.prototype.exec = function() {return null};
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
1

In my case, I was trying to get the index of a non-indexed array to iterate it. The code was:

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

this keyword represented the data I was trying to get the index of. So using it would be:

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

To fix this, I modified it to be a regular function, then pass the data as a parameter. The new function would look like this:

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

And passing the data:

const element = getByIndex(groupedData, index);
Ruslan
  • 162
  • 2
  • 13