1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

More defensive deepFreeze()

IE11 chokes on Object.freeze(undefined)
This commit is contained in:
Jermolene 2017-03-17 14:20:04 +00:00
parent 779e62a30f
commit b9fbe12118

View File

@ -224,11 +224,13 @@ exports.extendDeepCopy = function(object,extendedProperties) {
exports.deepFreeze = function deepFreeze(object) { exports.deepFreeze = function deepFreeze(object) {
var property, key; var property, key;
Object.freeze(object); if(object) {
for(key in object) { Object.freeze(object);
property = object[key]; for(key in object) {
if($tw.utils.hop(object,key) && (typeof property === "object") && !Object.isFrozen(property)) { property = object[key];
deepFreeze(property); if($tw.utils.hop(object,key) && (typeof property === "object") && !Object.isFrozen(property)) {
deepFreeze(property);
}
} }
} }
}; };