mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-05-10 22:31:04 -07:00
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 |
||
|---|---|---|
| .. | ||
| editor | ||
| filterrunprefixes | ||
| filters | ||
| indexers | ||
| info | ||
| macros | ||
| parsers | ||
| relinkers | ||
| savers | ||
| startup | ||
| storyviews | ||
| upgraders | ||
| utils | ||
| widgets | ||
| background-actions.js | ||
| config.js | ||
| deserializers.js | ||
| filter-tracker.js | ||
| filters.js | ||
| keyboard.js | ||
| language.js | ||
| pluginswitcher.js | ||
| saver-handler.js | ||
| story.js | ||
| syncer.js | ||
| tiddler.js | ||
| wiki-bulkops.js | ||
| wiki.js | ||