mirror of
https://github.com/donl/JSON-js.git
synced 2026-05-25 22:06:23 -06:00
Defense against window.prototype
This commit is contained in:
parent
40f3377a63
commit
43d7836c8e
2 changed files with 4 additions and 6 deletions
5
json.js
Executable file → Normal file
5
json.js
Executable file → Normal file
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
json.js
|
||||
2011-08-30
|
||||
2012-10-08
|
||||
|
||||
Public Domain
|
||||
|
||||
|
|
@ -196,8 +196,7 @@
|
|||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
if (typeof JSON !== 'object') {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
|
|
|
|||
5
json2.js
5
json2.js
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
json2.js
|
||||
2011-10-19
|
||||
2012-10-08
|
||||
|
||||
Public Domain.
|
||||
|
||||
|
|
@ -159,8 +159,7 @@
|
|||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
if (typeof JSON !== 'object') {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue