Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Defense against window.prototype
  • Loading branch information
douglascrockford committed Oct 8, 2012
1 parent 40f3377 commit 43d7836
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions json.js 100755 → 100644
@@ -1,6 +1,6 @@
/* /*
json.js json.js
2011-08-30 2012-10-08
Public Domain Public Domain
Expand Down Expand Up @@ -196,8 +196,7 @@
// Create a JSON object only if one does not already exist. We create the // Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables. // methods in a closure to avoid creating global variables.


var JSON; if (typeof JSON !== 'object') {
if (!JSON) {
JSON = {}; JSON = {};
} }


Expand Down
5 changes: 2 additions & 3 deletions json2.js
@@ -1,6 +1,6 @@
/* /*
json2.js json2.js
2011-10-19 2012-10-08
Public Domain. Public Domain.
Expand Down Expand Up @@ -159,8 +159,7 @@
// Create a JSON object only if one does not already exist. We create the // Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables. // methods in a closure to avoid creating global variables.


var JSON; if (typeof JSON !== 'object') {
if (!JSON) {
JSON = {}; JSON = {};
} }


Expand Down

0 comments on commit 43d7836

Please sign in to comment.