daleharvey / pacman

HTML5 Pacman
Do What The F*ck You Want To Public License
697 stars 470 forks source link

Set non-enumerable for Object.prototype.clone() #9

Open GoToLoop opened 8 years ago

GoToLoop commented 8 years ago

"pacman.js" can't mix up w/ other scripts which rely on for...in or Object.keys() but don't check for hasOwnProperty().

Any inclusions for built-in native objects should be accompanied by Object.defineProperty() and have its new method set to { enumerable: false }!

Here's the forum thread which has inspired this fix: :D https://forum.Processing.org/two/discussion/13501/p5-js-crash-when-including-a-new-js-file-packman-js-in-the-same-html-file

deansimcox commented 8 years ago

You're a legend. +1 for including this in the repo