Select to view content in your preferred language

Custom web application error Uncaught ReferenceError - only works in Internet Explorer

1074
3
Jump to solution
06-03-2022 08:47 AM
JeremyMack_LU
Occasional Contributor

I have a user that had a custom web application built for them a long time ago that uses the JS API. Over the past couple of years, it has slowly stopped working in every web browser, except Internet Explorer (which is soon to go away). The last version of the API that it worked on in more than IE was 3.10. Updating to 3.40 gets the same error(s), but still works in IE.

The error from the console in Chrome is:

Uncaught ReferenceError: normal is not defined
    at eval (eval at a (main.js:2:352), <anonymous>:1:1)
    at a (main.js:2:352)
    at loaded (load-css.js:236:7)
    at cbOnce (load-css.js:198:6)
    at ssWatcher (load-css.js:178:6)
    at load-css.js:181:31

Any suggestions would be welcomed.

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

If it's the same issue, I ran into this one not too long ago with an application still using 3.14.  In this case, it's a problem in xstyle, which is included in the ArcGIS API for JavaScript.  For further reference, see this page.

The code shown on that linked page is slightly different than what I've found included with 3.14 though.  However, you can find the affected code in api\xstyle\css.js.  In that file, the fix I applied in 3.14 was to change the text:

a&&"none"!=a?b([eval(a)],d):d()

to

a&&"none"!=a&&"normal"!=a?b([eval(a)],d):d()

 

Basically, I just added a second condition to check that the value of "a" did not equal "normal".  Here's what a diff utility shows after formatting the before-and-after products:

diff.png

View solution in original post

3 Replies
JoelBennett
MVP Regular Contributor

If it's the same issue, I ran into this one not too long ago with an application still using 3.14.  In this case, it's a problem in xstyle, which is included in the ArcGIS API for JavaScript.  For further reference, see this page.

The code shown on that linked page is slightly different than what I've found included with 3.14 though.  However, you can find the affected code in api\xstyle\css.js.  In that file, the fix I applied in 3.14 was to change the text:

a&&"none"!=a?b([eval(a)],d):d()

to

a&&"none"!=a&&"normal"!=a?b([eval(a)],d):d()

 

Basically, I just added a second condition to check that the value of "a" did not equal "normal".  Here's what a diff utility shows after formatting the before-and-after products:

diff.png

JeremyMack_LU
Occasional Contributor

Thanks, @JoelBennett. It looks like they've fixed the issue that you described. When I checked css.js it looked like this: k&&"none"!=k&&"normal"!=k?c([eval(k)]

0 Kudos
JeremyMack_LU
Occasional Contributor

@JoelBennett, I kept running with your suggestion and scraped the rest of the .js files associated with the app and found a file in js/dbootstrap called main.js that had the same xstyle definition. Adding the second condition fixed the issue. Many thanks!