* Fix RSOD when $tw.utils.addClass receives a class string with whitespace
PR #9251 replaced the manual setAttribute("class", ...) implementation of
$tw.utils.addClass/removeClass/toggleClass with direct Element.classList
calls. Unlike setAttribute, classList.add/remove/toggle throws
InvalidCharacterError on any token containing whitespace, so callers that
pass a whole class string (e.g. modal.js passing tiddler.fields.class)
now crash.
Manual repro on tw5-com: open SampleWizard, set the `class` field to
"aaa bbb", Done, open popup -> OK -> open nested popup -> RSOD.
Fix: split the className argument on whitespace in deprecated.js and feed
individual tokens to classList. A small splitClasses() helper keeps the
three functions symmetrical.
Adds adversarial regression tests in test-utils.js covering:
- ASCII whitespace variants (space, tab, CR, LF, mixed runs, padding)
- Unicode whitespace (U+00A0 non-breaking space)
- de-duplication across single and multiple calls
- remove/toggle no-op on missing tokens
- toggle with status undefined / true / false
- silent no-op for whitespace-only / empty / non-string / null input
- silent no-op when the element has no classList
* Move new tests to their own file
* Add backwards-compat regression tests for deprecated.js
Locks in pre-5.4.0 tolerant behaviour of $:/core/modules/utils/
deprecated.js helpers that regressed in PR #9251. Each spec targets an
edge-case input the current one-line modern equivalents reject:
- repeat: negative count / null / undefined str
- startsWith / endsWith: RegExp search arg
- stringifyNumber: null / undefined
- domContains: boolean return, self-check
- hasClass: null element, classless element
- getLocationPath: query preservation, hash stripping
(browser-only; pends in Node because the TW5 sandbox has no `window`)
Also picks up the addClass/removeClass/toggleClass whitespace specs
moved out of test-utils.js by the previous commit, so all deprecated.js
coverage lives together.
Fails 8 specs on current HEAD; the follow-up deprecated.js restoration
commit turns them green.
* Restore pre-5.4.0 behaviour of deprecated.js utilities
PR #9251 replaced several helpers in $:/core/modules/utils/deprecated.js
with one-line ES2017 equivalents that diverge from the originals on
edge-case inputs. Follow-up PRs fixed the most visible cases
(getLocationHash #9622, isDate #9771, addClass empty-string #9561 and
whitespace 005e17537); this commit closes the rest:
- repeat: manual loop tolerates negative count / null / undefined str
- startsWith / endsWith: substring compare tolerates RegExp search arg
- stringifyNumber: `num + ""` coercion tolerates null / undefined
- domContains: `a !== b && a.contains(b)` returns boolean, handles self
- hasClass: null-element guard, strict-false return
- getLocationPath: `toString().split("#")[0]` preserves the query
string in permalinks (startup/story.js:214, 217) -- the most visible
user-facing regression, causing ?lang=de etc. to silently drop.
IE-only fallbacks in Math.sign, strEndsWith, domContains, and
domMatchesSelector are removed; TW5 no longer supports IE.
Covered by the regression specs added in the previous commit.
* make comments more refined
PR #8093 used `child.children.length === 0` to distinguish a plain <option> from an <optgroup>. This test misfires when an <option> contains inline HTML.
E.g. tc-tiddlylink anchors auto-generated for "$:/..." titles.
So on refresh the option's `selected` state was never restored.
- This change switches to a tagName check.
- Adds a regression test plus a guard for the original PR #8092 optgroup
behaviour.
* fix: limit macro call parser to need >> to work, prevent > in regex
* test: add malformed macro parameter regression coverage
The parser fix on this branch only changes parseMacroParameterAsAttribute() when an unquoted value starts with <<, so the previous broader parser tests did not prove the regression. Add a focused structural test that fails without the guard and passes with it.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* Revert "fix: limit macro call parser to need >> to work, prevent > in regex"
This reverts commit f96b062902.
* lint: test
* Reapply "fix: limit macro call parser to need >> to work, prevent > in regex"
This reverts commit 075f7cc282.
---------
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
The reAttributeName regexp in parseMacroParameterAsAttribute was too
permissive, allowing single-character names like dollar sign followed by
colon. This caused values such as dollar-colon-slash-plugins-foo to be
mis-parsed as a named parameter dollar with value slash-plugins-foo.
Fix: when the separator is colon (legacy syntax), require the parameter
name to match [A-Za-z0-9-_]+ (same as the historic parseMacroParameter).
When the separator is equals (new-style dynamic parameters from #9055),
the wide character set is preserved so that names like double-dollar-one
continue to work.
Adds regression test Transclude/Procedures/Dollar/Param.
* [ja_JP] Japanese translation update from commit: a71ac56
* [ja_JP] Japanese translation update from commit: 32a3a3e
* [ja_JP] Japanese translation update from commit: 65fcded
* [ja_JP] Japanese translation update from commit: a3acbaa
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\functions\Functions.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\functions\Functions.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\definitions\Base64.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\definitions\Definitions.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\definitions\Cascading Style Sheets.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\definitions\Tiddlyhost.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\reference\Reference.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\concepts\WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Horizontal Rules in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\_tw_shared\doc-utilities\wikitext-macros.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Block Quotes in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Code Blocks in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Conditional Shortcut Syntax.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Block Quotes in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Block Quotes in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Dashes in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Description Lists in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Filtered Attribute Values.tid'
* [ja-JP] A little correction to the Japanese translation
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Formatting in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Headings in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Paragraphs in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Hard Linebreaks in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Hard_Linebreaks_with_CSS.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\howtos\Hard_Linebreaks_with_CSS_-_Example.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\HTML Entities.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Literal Attribute Values.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Lists in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Tables in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Table Classes Captions Headers and Footers.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transcluded Attribute Values.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Utility Classes.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Widgets in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\parser\WikiText Parser Modes.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\HTML in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\HTML_Links_in_WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Typed Blocks in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Anchor Links using HTML.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Linking in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Macro Calls.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Macro Definitions.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Macro Parameter Handling.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Substituted Attribute Values.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Substituted Attribute Values.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\Concatenating variables to create a URL.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\Concatenating a text reference to create a URL.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\procedures\Procedure Calls.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\procedures\Procedure Definitions.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\procedures\Procedure Parameter Handling.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transclusion and Substitution.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transclusion in WikiText.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transclusion Basic Usage.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transclusion Basic Usage.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Transclusion with Templates.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Variable Attribute Values.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\variables\Behaviour of variables invoked via widget attributes.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Tables in WikiText CSS Utility Classes.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\Widget Attributes.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\concepts\TemplateTiddlers.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\concepts\Transclusion.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\parser\table-example.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\wikitext\parser\WikiText parser mode_ transclusion examples.tid'
* [ja-JP] Japanese translation of 'editions\tw5.com\tiddlers\concepts\TextReference.tid'