mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-29 05:13:56 -08:00
For five minutes I stared at the following code...
if(value != null && typeof value === "object") {
Object.freeze(value);
}
... and at the error message that led me to this code: `Object.freeze called on non-object`
And then I remembered that js treads null as object (http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.3). This means the `typeof === "object"` will not discover null and freeze will throw an error...
So `value != null` will also work when value is undefined.
A hard to find bug ;)
|
||
|---|---|---|
| .. | ||
| boot.css.tid | ||
| boot.js | ||
| bootprefix.js | ||
| sjcl.js | ||
| sjcl.js.meta | ||