mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
More defensive deepFreeze()
IE11 chokes on Object.freeze(undefined)
This commit is contained in:
parent
779e62a30f
commit
b9fbe12118
@ -224,11 +224,13 @@ exports.extendDeepCopy = function(object,extendedProperties) {
|
||||
|
||||
exports.deepFreeze = function deepFreeze(object) {
|
||||
var property, key;
|
||||
Object.freeze(object);
|
||||
for(key in object) {
|
||||
property = object[key];
|
||||
if($tw.utils.hop(object,key) && (typeof property === "object") && !Object.isFrozen(property)) {
|
||||
deepFreeze(property);
|
||||
if(object) {
|
||||
Object.freeze(object);
|
||||
for(key in object) {
|
||||
property = object[key];
|
||||
if($tw.utils.hop(object,key) && (typeof property === "object") && !Object.isFrozen(property)) {
|
||||
deepFreeze(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user