Skip to content

Commit b6d4097

Browse files
committed
netteForms.js: removed support for IE 7, typo
1 parent 8b394f1 commit b6d4097

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/assets/netteForms.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
*/
77

88
(function(global, factory) {
9+
if (!global.JSON) {
10+
return;
11+
}
12+
913
if (typeof define === 'function' && define.amd) {
1014
define(function() {
1115
return factory(global);
@@ -489,11 +493,9 @@ Nette.toggleControl = function(elem, rules, success, firsttime, value) {
489493

490494

491495
Nette.parseJSON = function(s) {
492-
s = s || '[]';
493-
if (s.substr(0, 3) === '{op') {
494-
return eval('[' + s + ']'); // backward compatibility
495-
}
496-
return window.JSON && window.JSON.parse ? JSON.parse(s) : eval(s);
496+
return (s || '').substr(0, 3) === '{op'
497+
? eval('[' + s + ']') // backward compatibility with Nette 2.0.x
498+
: JSON.parse(s || '[]');
497499
};
498500

499501

0 commit comments

Comments
 (0)