From 60d99ccad520153165df864dcc7e6a8d1b39b61e Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Sun, 5 Apr 2015 21:15:19 +0300 Subject: [PATCH] Version 1.5.2: JSON2 library was updated to version of February 25, 2015. --- CHANGELOG.md | 3 + .../Properties/AssemblyInfo.cs | 4 +- MsieJavaScriptEngine/Resources/json2.js | 103 +++++++++++------- MsieJavaScriptEngine/Resources/json2.min.js | 2 +- NuGet/MsieJavaScriptEngine.nuspec | 4 +- NuGet/readme.txt | 5 +- 6 files changed, 73 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8504193..cbfc184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Change log ========== +## April 5, 2015 - v1.5.2 + * JSON2 library was updated to version of February 25, 2015 + ## January 13, 2015 - v1.5.1 * In ECMAScript 5 Polyfill added polyfill for the `String.prototype.split` method diff --git a/MsieJavaScriptEngine/Properties/AssemblyInfo.cs b/MsieJavaScriptEngine/Properties/AssemblyInfo.cs index d880b6a..1540e71 100644 --- a/MsieJavaScriptEngine/Properties/AssemblyInfo.cs +++ b/MsieJavaScriptEngine/Properties/AssemblyInfo.cs @@ -13,7 +13,7 @@ [assembly: ComVisible(false)] [assembly: Guid("ae6911c9-e2a9-4386-ab90-3722a9166564")] -[assembly: AssemblyVersion("1.5.1.0")] -[assembly: AssemblyFileVersion("1.5.1.0")] +[assembly: AssemblyVersion("1.5.2.0")] +[assembly: AssemblyFileVersion("1.5.2.0")] [module: DefaultCharSet(CharSet.Unicode)] \ No newline at end of file diff --git a/MsieJavaScriptEngine/Resources/json2.js b/MsieJavaScriptEngine/Resources/json2.js index deb88ec..d403181 100644 --- a/MsieJavaScriptEngine/Resources/json2.js +++ b/MsieJavaScriptEngine/Resources/json2.js @@ -1,6 +1,6 @@ /* json2.js - 2014-02-04 + 2015-02-25 Public Domain. @@ -48,7 +48,9 @@ Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; + return n < 10 + ? '0' + n + : n; } return this.getUTCFullYear() + '-' + @@ -146,10 +148,12 @@ redistribute. */ -/*jslint evil: true, regexp: true */ +/*jslint + eval, for, this +*/ -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, +/*property + JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf @@ -168,7 +172,13 @@ if (typeof JSON !== 'object') { function f(n) { // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; + return n < 10 + ? '0' + n + : n; + } + + function this_value() { + return this.valueOf(); } if (typeof Date.prototype.toJSON !== 'function') { @@ -176,20 +186,18 @@ if (typeof JSON !== 'object') { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) - ? this.getUTCFullYear() + '-' + + ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' - : null; + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z' + : null; }; - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function () { - return this.valueOf(); - }; + Boolean.prototype.toJSON = this_value; + Number.prototype.toJSON = this_value; + String.prototype.toJSON = this_value; } var cx, @@ -208,12 +216,14 @@ if (typeof JSON !== 'object') { // sequences. escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + return escapable.test(string) + ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; + ? c + : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' + : '"' + string + '"'; } @@ -253,7 +263,9 @@ if (typeof JSON !== 'object') { // JSON numbers must be finite. Encode non-finite numbers as null. - return isFinite(value) ? String(value) : 'null'; + return isFinite(value) + ? String(value) + : 'null'; case 'boolean': case 'null': @@ -297,10 +309,10 @@ if (typeof JSON !== 'object') { // brackets. v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; + ? '[]' + : gap + ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' + : '[' + partial.join(',') + ']'; gap = mind; return v; } @@ -314,7 +326,11 @@ if (typeof JSON !== 'object') { k = rep[i]; v = str(k, value); if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); + partial.push(quote(k) + ( + gap + ? ': ' + : ':' + ) + v); } } } @@ -326,7 +342,11 @@ if (typeof JSON !== 'object') { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); + partial.push(quote(k) + ( + gap + ? ': ' + : ':' + ) + v); } } } @@ -336,10 +356,10 @@ if (typeof JSON !== 'object') { // and wrap them in braces. v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; + ? '{}' + : gap + ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' + : '{' + partial.join(',') + '}'; gap = mind; return v; } @@ -348,14 +368,14 @@ if (typeof JSON !== 'object') { // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', - '"' : '\\"', + '"': '\\"', '\\': '\\\\' }; JSON.stringify = function (value, replacer, space) { @@ -444,7 +464,7 @@ if (typeof JSON !== 'object') { if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } @@ -461,10 +481,13 @@ if (typeof JSON !== 'object') { // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + if ( + /^[\],:{}\s]*$/.test( + text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + .replace(/(?:^|:|,)(?:\s*\[)+/g, '') + ) + ) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity @@ -477,8 +500,8 @@ if (typeof JSON !== 'object') { // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' - ? walk({'': j}, '') - : j; + ? walk({'': j}, '') + : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. diff --git a/MsieJavaScriptEngine/Resources/json2.min.js b/MsieJavaScriptEngine/Resources/json2.min.js index b66e63a..4bc2d47 100644 --- a/MsieJavaScriptEngine/Resources/json2.min.js +++ b/MsieJavaScriptEngine/Resources/json2.min.js @@ -1 +1 @@ -typeof JSON!="object"&&(JSON={}),function(){"use strict";function i(n){return n<10?"0"+n:n}function o(n){return u.lastIndex=0,u.test(n)?'"'+n.replace(u,function(n){var t=s[n];return typeof t=="string"?t:"\\u"+("0000"+n.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+n+'"'}function e(i,r){var s,l,h,a,v=n,c,u=r[i];u&&typeof u=="object"&&typeof u.toJSON=="function"&&(u=u.toJSON(i));typeof t=="function"&&(u=t.call(r,i,u));switch(typeof u){case"string":return o(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(n+=f,c=[],Object.prototype.toString.apply(u)==="[object Array]"){for(a=u.length,s=0;s MsieJavaScriptEngine - 1.5.1 + 1.5.2 MSIE JavaScript Engine for .NET Andrey Taritsyn Andrey Taritsyn @@ -12,7 +12,7 @@ false This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). Project was based on the code of SassAndCoffee.JavaScript (http://github.com/paulcbetts/SassAndCoffee) and Chakra Sample Hosts (http://github.com/panopticoncentral/chakra-host). This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). - In ECMAScript 5 Polyfill added polyfill for the `String.prototype.split` method. + JSON2 library was updated to version of February 25, 2015. Copyright (c) 2012-2015 Andrey Taritsyn - http://www.taritsyn.ru en-US JavaScript ECMAScript MSIE IE Chakra diff --git a/NuGet/readme.txt b/NuGet/readme.txt index 245876a..5621424 100644 --- a/NuGet/readme.txt +++ b/NuGet/readme.txt @@ -1,7 +1,7 @@ ---------------------------------------------------------------------- - README file for MSIE JavaScript Engine for .NET 1.5.1 + README file for MSIE JavaScript Engine for .NET 1.5.2 ---------------------------------------------------------------------- @@ -21,8 +21,7 @@ ============= RELEASE NOTES ============= - In ECMAScript 5 Polyfill added polyfill for - the `String.prototype.split` method. + JSON2 library was updated to version of February 25, 2015. ============ PROJECT SITE