diff --git a/packages/json/json_native.js b/packages/json/json_native.js new file mode 100644 index 0000000000..bbb4e00f84 --- /dev/null +++ b/packages/json/json_native.js @@ -0,0 +1,3 @@ +// Do we already have a global JSON object? Export it as our JSON object. +if (window.JSON) + JSON = window.JSON; diff --git a/packages/json/package.js b/packages/json/package.js index 87602a5998..abb6a2ec71 100644 --- a/packages/json/package.js +++ b/packages/json/package.js @@ -3,10 +3,12 @@ Package.describe({ internal: true }); -// We need to figure out how to serve this file only to browsers that -// don't have JSON.stringify (eg, IE7 and earlier -- or is that IE8?) +// We need to figure out how to serve this file only to browsers that don't have +// JSON.stringify (eg, IE7 and earlier, and IE8 outside of "standards mode") Package.on_use(function (api) { // Node always has JSON; we only need this in some browsers. + api.export('JSON', 'client'); + api.add_files('json_native.js', 'client'); api.add_files('json2.js', 'client'); });