Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript error in IE8: Not implemented

This one really puzzles me, as the code looks completely harmless.

IE8 halts script execution with a message:

Not implemented. map.js line:66 char:5

Here is a snip from the code:

63 if(data.map[x] !== undefined && data.map[x][y] !== undefined) {
64              
65   left = (x - data.dim.x_min)*32 + 30;
66   top = (data.dim.y_max - y)*32 + 30;
67
68  /* do stuff */
XX }

debug info: x:263 data.dim.x_min:263 y:172 data.dim.y_max:174

Data is object returned from JQuery Ajax call. This works in Firefox 3.0 and 3.5, safari 4.0.2 and I've only found this error when viewing the page in IE8. Forcing IE8 into IE7 mode does not make the error go away.

I don't have IE7 to debug with, but I got a tester saying that it doesn't work in IE7 either.

like image 380
Fuu Avatar asked Aug 14 '09 18:08

Fuu


2 Answers

The variable 'top' used in the code is an object of type DispHTMLWindow2 (outermost window object) and already in use by the browsers and that is causing the conflict, as that object cant be the target of the assignment operation. It seems that Firefox and Safari ignore this, while IE does not allow scripts to overwrite this.

Solutions for this:

1) Declare top you are using as local variable to define it's scope where it is used.

2) Rename the variable to something that doesn't conflict with this predefined global.

Description of other variable names you shouldn't use

like image 200
Fuu Avatar answered Oct 20 '22 03:10

Fuu


IE 8 has a great javascript debugger. You might want to add a breakpoint somewhere before the error and step through the code to see if something is strange with the data. IE8 is picky with trailing commas in lists which might be why you only get the error in it. You can pull the debugger up with F12, click Script and choose start debugging. You can add a break point by clicking on the margin where the line numbers are.

like image 2
camomileCase Avatar answered Oct 20 '22 02:10

camomileCase