Skip to content

Commit

Permalink
[renderjson.js] Add fix for hasOwnProperty is not a function error
Browse files Browse the repository at this point in the history
I ran into a scenario where a node didn't have a prototype (or
hasOwnProperty method). This apparently happens if an object is created
using Object.create(null).

Closes #13
  • Loading branch information
itslenny authored and caldwell committed Apr 13, 2016
1 parent 745e979 commit af16ec7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion renderjson.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var module;
el.insertBefore(child, el.firstChild);
return el;
}
var isempty = function(obj) { for (var k in obj) if (obj.hasOwnProperty(k)) return false;
var isempty = function(obj) { for (var k in obj) if (Object.hasOwnProperty.call(obj, k)) return false;
return true; }
var text = function(txt) { return document.createTextNode(txt) };
var div = function() { return document.createElement("div") };
Expand Down

0 comments on commit af16ec7

Please sign in to comment.