<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[17679] trunk/wp-includes: Update json2.js, props niallkennedy,
fixes #16669</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17679">17679</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-04-21 22:21:27 +0000 (Thu, 21 Apr 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update json2.js, props niallkennedy, fixes <a href="http://trac.wordpress.org/ticket/16669">#16669</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsjson2devjs">trunk/wp-includes/js/json2.dev.js</a></li>
<li><a href="#trunkwpincludesjsjson2js">trunk/wp-includes/js/json2.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjsjson2devjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/json2.dev.js (17678 => 17679)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/json2.dev.js        2011-04-21 20:44:39 UTC (rev 17678)
+++ trunk/wp-includes/js/json2.dev.js        2011-04-21 22:21:27 UTC (rev 17679)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> http://www.JSON.org/json2.js
</span><del>- 2009-08-17
</del><ins>+ 2011-02-23
</ins><span class="cx">
</span><span class="cx"> Public Domain.
</span><span class="cx">
</span><span class="lines">@@ -8,6 +8,14 @@
</span><span class="cx">
</span><span class="cx"> See http://www.JSON.org/js.html
</span><span class="cx">
</span><ins>+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+
+
</ins><span class="cx"> This file creates a global JSON object containing two methods: stringify
</span><span class="cx"> and parse.
</span><span class="cx">
</span><span class="lines">@@ -136,15 +144,9 @@
</span><span class="cx">
</span><span class="cx"> This is a reference implementation. You are free to copy, modify, or
</span><span class="cx"> redistribute.
</span><del>-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
</del><span class="cx"> */
</span><span class="cx">
</span><del>-/*jslint evil: true */
</del><ins>+/*jslint evil: true, strict: false, regexp: false */
</ins><span class="cx">
</span><span class="cx"> /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
</span><span class="cx"> call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
</span><span class="lines">@@ -153,16 +155,17 @@
</span><span class="cx"> test, toJSON, toString, valueOf
</span><span class="cx"> */
</span><span class="cx">
</span><del>-"use strict";
</del><span class="cx">
</span><span class="cx"> // Create a JSON object only if one does not already exist. We create the
</span><span class="cx"> // methods in a closure to avoid creating global variables.
</span><span class="cx">
</span><del>-if (!this.JSON) {
- this.JSON = {};
</del><ins>+var JSON;
+if (!JSON) {
+ JSON = {};
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> (function () {
</span><ins>+ "use strict";
</ins><span class="cx">
</span><span class="cx"> function f(n) {
</span><span class="cx"> // Format integers to have at least two digits.
</span><span class="lines">@@ -174,19 +177,19 @@
</span><span class="cx"> Date.prototype.toJSON = function (key) {
</span><span class="cx">
</span><span class="cx"> return isFinite(this.valueOf()) ?
</span><del>- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
</del><ins>+ this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z' : null;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
</del><ins>+ String.prototype.toJSON =
+ Number.prototype.toJSON =
+ Boolean.prototype.toJSON = function (key) {
+ return this.valueOf();
+ };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
</span><span class="lines">@@ -213,13 +216,11 @@
</span><span class="cx"> // sequences.
</span><span class="cx">
</span><span class="cx"> escapable.lastIndex = 0;
</span><del>- 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 + '"';
</del><ins>+ 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 + '"';
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -302,11 +303,9 @@
</span><span class="cx"> // Join all of the elements together, separated with commas, and wrap them in
</span><span class="cx"> // brackets.
</span><span class="cx">
</span><del>- v = partial.length === 0 ? '[]' :
- gap ? '[\n' + gap +
- partial.join(',\n' + gap) + '\n' +
- mind + ']' :
- '[' + partial.join(',') + ']';
</del><ins>+ v = partial.length === 0 ? '[]' : gap ?
+ '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
+ '[' + partial.join(',') + ']';
</ins><span class="cx"> gap = mind;
</span><span class="cx"> return v;
</span><span class="cx"> }
</span><span class="lines">@@ -316,8 +315,8 @@
</span><span class="cx"> if (rep && typeof rep === 'object') {
</span><span class="cx"> length = rep.length;
</span><span class="cx"> for (i = 0; i < length; i += 1) {
</span><del>- k = rep[i];
- if (typeof k === 'string') {
</del><ins>+ if (typeof rep[i] === 'string') {
+ k = rep[i];
</ins><span class="cx"> v = str(k, value);
</span><span class="cx"> if (v) {
</span><span class="cx"> partial.push(quote(k) + (gap ? ': ' : ':') + v);
</span><span class="lines">@@ -329,7 +328,7 @@
</span><span class="cx"> // Otherwise, iterate through all of the keys in the object.
</span><span class="cx">
</span><span class="cx"> for (k in value) {
</span><del>- if (Object.hasOwnProperty.call(value, k)) {
</del><ins>+ if (Object.prototype.hasOwnProperty.call(value, k)) {
</ins><span class="cx"> v = str(k, value);
</span><span class="cx"> if (v) {
</span><span class="cx"> partial.push(quote(k) + (gap ? ': ' : ':') + v);
</span><span class="lines">@@ -341,9 +340,9 @@
</span><span class="cx"> // Join all of the member texts together, separated with commas,
</span><span class="cx"> // and wrap them in braces.
</span><span class="cx">
</span><del>- v = partial.length === 0 ? '{}' :
- gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
- mind + '}' : '{' + partial.join(',') + '}';
</del><ins>+ v = partial.length === 0 ? '{}' : gap ?
+ '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
+ '{' + partial.join(',') + '}';
</ins><span class="cx"> gap = mind;
</span><span class="cx"> return v;
</span><span class="cx"> }
</span><span class="lines">@@ -384,7 +383,7 @@
</span><span class="cx"> rep = replacer;
</span><span class="cx"> if (replacer && typeof replacer !== 'function' &&
</span><span class="cx"> (typeof replacer !== 'object' ||
</span><del>- typeof replacer.length !== 'number')) {
</del><ins>+ typeof replacer.length !== 'number')) {
</ins><span class="cx"> throw new Error('JSON.stringify');
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -414,7 +413,7 @@
</span><span class="cx"> var k, v, value = holder[key];
</span><span class="cx"> if (value && typeof value === 'object') {
</span><span class="cx"> for (k in value) {
</span><del>- if (Object.hasOwnProperty.call(value, k)) {
</del><ins>+ if (Object.prototype.hasOwnProperty.call(value, k)) {
</ins><span class="cx"> v = walk(value, k);
</span><span class="cx"> if (v !== undefined) {
</span><span class="cx"> value[k] = v;
</span><span class="lines">@@ -432,6 +431,7 @@
</span><span class="cx"> // Unicode characters with escape sequences. JavaScript handles many characters
</span><span class="cx"> // incorrectly, either silently deleting them, or treating them as line endings.
</span><span class="cx">
</span><ins>+ text = String(text);
</ins><span class="cx"> cx.lastIndex = 0;
</span><span class="cx"> if (cx.test(text)) {
</span><span class="cx"> text = text.replace(cx, function (a) {
</span><span class="lines">@@ -453,10 +453,10 @@
</span><span class="cx"> // we look to see that the remaining characters are only whitespace or ']' or
</span><span class="cx"> // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
</span><span class="cx">
</span><del>- 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, ''))) {
</del><ins>+ 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, ''))) {
</ins><span class="cx">
</span><span class="cx"> // In the third stage we use the eval function to compile the text into a
</span><span class="cx"> // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
</span><span class="lines">@@ -478,4 +478,3 @@
</span><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> }());
</span><del>-
</del></span></pre></div>
<a id="trunkwpincludesjsjson2js"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/json2.js (17678 => 17679)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/json2.js        2011-04-21 20:44:39 UTC (rev 17678)
+++ trunk/wp-includes/js/json2.js        2011-04-21 22:21:27 UTC (rev 17679)
</span><span class="lines">@@ -1 +1 @@
</span><del>-"use strict";if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+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(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;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+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}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,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
</del><span class="cx">\ No newline at end of file
</span><ins>+var JSON;if(!JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+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(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;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+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}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,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (17678 => 17679)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2011-04-21 20:44:39 UTC (rev 17678)
+++ trunk/wp-includes/script-loader.php        2011-04-21 22:21:27 UTC (rev 17679)
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx">
</span><span class="cx">         $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
</span><span class="cx">
</span><del>-        $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", false, '20110113');
</del><ins>+        $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", false, '2011-02-23');
</ins><span class="cx">
</span><span class="cx">         $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.1-20110113' );
</span><span class="cx">         $scripts->add_data( 'imgareaselect', 'group', 1 );
</span></span></pre>
</div>
</div>
</body>
</html>