Skip to content

Side effects of overwriting the built-in JSON Object #226

Open
@jibesh

Description

@jibesh

Including PreloadJS (version 0.6.0) in browser overwrites the built-in JSON Object. As a result, the properties of the JSON object now becomes enumerable.

// built-in Chrome 56
console.log(Object.keys(JSON));
[]

// Including PreloadJS
console.log(Object.keys(JSON));
["parse", "stringify"]

I would like to suggest to make the properties non-enumerable.

Additionally, a property introduced in the ECMAScript 6 standards becomes undefined.

// built-in Chrome 56
JSON[Symbol.toStringTag];
"JSON"

// Including PreloadJS
JSON[Symbol.toStringTag];
undefined

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions