codegooglecom / json-template

Automatically exported from code.google.com/p/json-template
0 stars 0 forks source link

Live example doesn't work in IE6 #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by patmf...@gmail.com on 31 Mar 2009 at 5:50

Attachments:

GoogleCodeExporter commented 9 years ago
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

Original comment by gtempacc...@yahoo.com on 31 Mar 2009 at 9:30

GoogleCodeExporter commented 9 years ago
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

Original comment by guido.sc...@gmail.com on 6 Apr 2009 at 10:48

GoogleCodeExporter commented 9 years ago
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).

Original comment by andyc...@gmail.com on 6 Apr 2009 at 4:25

GoogleCodeExporter commented 9 years ago
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..

Original comment by guido.sc...@gmail.com on 6 Apr 2009 at 5:06

GoogleCodeExporter commented 9 years ago
Thanks, your suggestions were spot on.

Original comment by gtempacc...@yahoo.com on 20 Apr 2009 at 8:10