The old code required a space after the colon separating the title
fragment from the text, and didn’t trim the strings. The new code is
more tolerant, by not requiring the space, and trimming the strings.
Fixes#2507
The problem stems from a JavaScript quirk: the fact that
`({“undefined":"Me"})[undefined]` returns “Me”. The quirk is that the
value `undefined` is coerced into the string “undefined” when used as
an index.
In this particular case, the code for `wiki.getTiddler()` was returning
the tiddler with the title `”undefined”` when called with the title set
to the value `undefined`. It happens that the pluginswitcher called
`wiki.getTiddler(undefined)`.
While JavaScript runtime errors include the line number within the
module tiddler where the error occured, syntax errors do not, leaving
the user guessing where the error is hiding. Attempt to remedy this, as
well as the various platforms permit.
As seen in the first pass of #2247, it was previously inadvertently
possible for callers to modify the tiddler object itself by adding and
replacing properties.
Part of the upcoming AWS integration work is a custom build of
TiddlyWiki that can run as an Amazon Lambda function. These tweaks
enable the new build to control the loading of SJCL, the package info,
and any preloaded tiddlers.
Astonishingly, it’s much quicker to use `Object.keys()` to get an array
of key names, and then iterate through that. I’m seeing 25% speed
improvements for an empty tiddler iterator.
Previously, we just read the target file as a block of UTF-8. With this
update, we deserialise the file, allowing us to use file formats like
.tid within the tiddlywiki.files file.
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 ;)
Previous changes since 5.1.7 broke the documented semantics by no
longer returning true when the versions match. It affected the upgrade
process, making it impossible to upgrade to a later pre-release (ie
where the version numbers in the upgrade.html match those in the file
being upgraded).
Also reviewed and updated the calls to checkVersions.
@felixhayashi I think that this effectively reverts the change you
original submitted. Are you OK with it?
Hopefully this will help resolve issues that @xcazin and @pmario have
been having with using the client-server configuration to prepare
translations of the TW5 docs.