2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 21:05:12 +00:00

Update src/jquery.autocomplete.js

Using the native JSON.parse built-in function in the browsers if it's available.
Adds more security to it, so the autocomplete is less prone to XSS attacks.
This commit is contained in:
Michiel 2012-11-15 16:21:55 +01:00
parent 8211e43cfd
commit 88bdbaf787

View File

@ -361,7 +361,10 @@
var response;
try {
response = eval('(' + text + ')');
if (typeof(JSON) != "undefined" && typeof(JSON.parse) != "undefined")
response = JSON.parse(text);
else
response = eval('(' + text + ')');
} catch (err) {
return;
}