kennygit / jcrop

Automatically exported from code.google.com/p/jcrop
0 stars 0 forks source link

jCrop in IE7 causing bad server requests #64

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
My usage of jCrop in IE7 results in URI requests on the server containing 
javascript fragments in the URI.

for example:
http://server/path/to/page/function(a)%7Bvar%20b=this.length%3E%3E%3E0

What is the expected output? What do you see instead?
I do not expect any queries on the server

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

Please provide any additional information below.

This is caused by a bad array iteration in createHandles(), which is attempting 
to add 'n', 's', 'e', 'w' and 'sw', 'nw', 'ne', 'se' handles to the crop region.

The following line is the culprit:
for (i in li)
    handle[li[i]] = insertHandle(li[i]);

When iterating arrays in javascript, the below method is correct:
for (var i = 0; i < li.length; i++)
    handle[li[i]] = insertHandle(li[i]);

When the array object has been extended this can results in functions being 
returned, for example in my case:
for(i in [ 'n', 's', 'e', 'w' ]){
    log(i);
}

results in:
indexOf
reduce
filter
map
forEach
0
1
2
3

To be correctly sociable with other js libraries, the correct iteration method 
should be used. Attached is a patch file for the non-minified version.

Original issue reported on code.google.com by naoku...@gmail.com on 25 Nov 2011 at 5:53

Attachments:

GoogleCodeExporter commented 8 years ago
Heh, that is not a patch file but the whole jcrop version 0.9.8 ;-)

Original comment by tyr...@gmail.com on 20 Dec 2011 at 8:06

GoogleCodeExporter commented 8 years ago
Snap.
At the time I posted this, my googling was returning 0.9.8 as the latest, 
however that isn't true. 0.9.9 is available here: 
http://deepliquid.com/content/Jcrop_Download.html
The newer version resolved this issue, so I'm not even using my 'patch'.

Original comment by naoku...@gmail.com on 21 Dec 2011 at 1:35