TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.04k stars 1.19k forks source link

[IDEA] We should probably update the .trim() code in utility.js ... with the JS built in functions #6262

Open pmario opened 2 years ago

pmario commented 2 years ago

See: https://github.com/Jermolene/TiddlyWiki5/blob/7fcc84156ed02d27ea0d27dc41fb84cd1a6e22fe/core/modules/utils/utils.js#L102 ..

We still use code built for FF 2 and IE 6. FF 3.5 got .trim which should be more optimized as the code we use and also works with IE 10

.trimStart and .trimEnd can't be used with IE ... So we may not use them?

Jermolene commented 2 years ago

Thanks @pmario the semantics of $tw.utils.trim() are awkward (see what happens with a non-string argument), and so while we should update the method to use trim() we should probably also carefully replace each invocation with a plain .trim() if the usage allows.