Skip to content

Commit

Permalink
Fix $extend to exclude prototype properties.
Browse files Browse the repository at this point in the history
Add fix for Firefox's Object.prototype.watch conflict.
Fixes jdorn#256 Fixes jdorn#249
  • Loading branch information
jdorn committed Sep 28, 2014
1 parent a97cc2a commit 80a4d4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ JSONEditor.AbstractEditor = Class.extend({
};

this.register();
if(this.schema.watch) {
if(this.schema.hasOwnProperty('watch')) {
var path,path_parts,first,root,adjusted_path;

for(var name in this.schema.watch) {
Expand Down
3 changes: 2 additions & 1 deletion src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ var $extend = function(destination) {
for(i=1; i<arguments.length; i++) {
source = arguments[i];
for (property in source) {
if(!source.hasOwnProperty(property)) continue;
if(source[property] && $isplainobject(source[property])) {
destination[property] = destination[property] || {};
if(!destination.hasOwnProperty(property)) destination[property] = {};
$extend(destination[property], source[property]);
}
else {
Expand Down

0 comments on commit 80a4d4e

Please sign in to comment.