Issue 5: Live example doesn't work in IE6
Status:  Fixed
Owner: ----
Closed:  Apr 2009
Reported by patmf...@gmail.com, Mar 31, 2009
What steps will reproduce the problem?
1. Run jslint on json-template.js

What is the expected output? What do you see instead?

Lint at line 376 character 25: Extra comma.
'space': ' ',


What version of the product are you using? On what operating system?

Windows IE6

Please provide any additional information below.

You mentioned in the demo that it doesn't work in IE6 so I thought I would
check it out.

First it didn't work but didn't give any debugger info, so I ran the script
through jslint, and it found an extra comma at the end of one of your objects:

Lint at line 376 character 25: Extra comma.
'space': ' ',

Then after removing that comma, it was giving me a debugger error, but I
haven't quite figured that out. Attaching debugger screenshot for your info.
debug.jpg
142 KB   View   Download
Mar 31, 2009
Project Member #1 gtempacc...@yahoo.com
Thanks, I just fixed all the jslint errors.

And that stack trace looks interesting... I guess there is some difference in IE
behavior.  I will have to look at that later tonight.

Basically that exception is thrown when there's an undefined template variable during
expansion.  But none of the other browsers see it as undefined.

http://json-template.googlecode.com/svn/trunk/doc/testTableExample-001.js.html

Summary: Live example doesn't work in IE6
Apr 6, 2009
#2 guido.sc...@gmail.com
The major reason IE6 is not working is that the String.prototype.split method does
not return captured groups in the result. For reference see
http://blog.stevenlevithan.com/archives/cross-browser-split. 

The other reason is that IE6 does not let you index strings as an array, so
"token[0]" needs to be replaced with "token.charAt(0)" in function "_Compile".

These two changes make it work in IE6

Apr 6, 2009
Project Member #3 andyc...@gmail.com
Great thanks.  I'm not sure if it's better to include that fix or just write a loop
by hand to tokenize it... the regex is pretty simple, so maybe we can get rid of it.

I will look at it this week (patches are welcome too).


Status: Accepted
Apr 6, 2009
#4 guido.sc...@gmail.com
Didn't have time to look into it further, just thought i'd let you know where the
problem arises.

I think if you'd do a "match" instead of a "split" it is basically fixed...

I will see if i have some time to look into it..
Apr 20, 2009
Project Member #5 gtempacc...@yahoo.com
Thanks, your suggestions were spot on.

Status: Fixed