fix: Support XHTML phrasing content in MathML token elements by rschristian · Pull Request #4924 · preactjs/preact (original ) (raw )
Fixes #4920
Fiddling w/ size & perf but I'm not really happy with this as it's such a niche need. MathML really should've reused <foreignObject> or created something similar.
📊 Tachometer Benchmark Results Summary duration
create10k: unsure 🔍 -0% - +0% (-2.47ms - +4.20ms) preact-local vs preact-main
filter-list: unsure 🔍 -0% - -0% (-0.06ms - -0.00ms) preact-local vs preact-main
hydrate1k: unsure 🔍 -1% - +2% (-1.02ms - +1.65ms) preact-local vs preact-main
many-updates: unsure 🔍 -3% - +4% (-0.55ms - +0.73ms) preact-local vs preact-main
replace1k: unsure 🔍 -1% - +2% (-0.56ms - +1.04ms) preact-local vs preact-main
text-update: unsure 🔍 -4% - +11% (-0.09ms - +0.23ms) preact-local vs preact-main
todo: slower ❌ 0% - 2% (0.09ms - 0.57ms) preact-local vs preact-main
update10th1k: unsure 🔍 -4% - +2% (-1.32ms - +0.79ms) preact-local vs preact-main
usedJSHeapSize
create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms) preact-local vs preact-main
filter-list: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms) preact-local vs preact-main
hydrate1k: unsure 🔍 -11% - +1% (-0.75ms - +0.07ms) preact-local vs preact-main
many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms) preact-local vs preact-main
replace1k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms) preact-local vs preact-main
text-update: unsure 🔍 -2% - +2% (-0.02ms - +0.02ms) preact-local vs preact-main
todo: unsure 🔍 -1% - +0% (-0.01ms - +0.01ms) preact-local vs preact-main
update10th1k: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms) preact-local vs preact-main
Resultscreate10k
Browser: chrome-headless
Sample size: 50
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
908.13ms - 912.60ms
-
unsure 🔍 -0% - +0%-2.47ms - +4.20ms
preact-main
907.02ms - 911.98ms
unsure 🔍 -0% - +0%-4.20ms - +2.47ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
19.04ms - 19.04ms
-
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
preact-main
19.04ms - 19.04ms
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
-
filter-list
Browser: chrome-headless
Sample size: 50
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
16.53ms - 16.57ms
-
unsure 🔍 -0% - -0%-0.06ms - -0.00ms
preact-main
16.56ms - 16.61ms
unsure 🔍 +0% - +0%+0.00ms - +0.06ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
1.54ms - 1.54ms
-
unsure 🔍 -0% - +0%-0.00ms - +0.01ms
preact-main
1.54ms - 1.54ms
unsure 🔍 -0% - +0%-0.01ms - +0.00ms
-
hydrate1k
Browser: chrome-headless
Sample size: 90
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
68.52ms - 70.48ms
-
unsure 🔍 -1% - +2%-1.02ms - +1.65ms
preact-main
68.27ms - 70.09ms
unsure 🔍 -2% - +1%-1.65ms - +1.02ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
6.19ms - 6.66ms
-
unsure 🔍 -11% - +1%-0.75ms - +0.07ms
preact-main
6.42ms - 7.10ms
unsure 🔍 -1% - +12%-0.07ms - +0.75ms
-
many-updates
Browser: chrome-headless
Sample size: 60
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
16.24ms - 17.13ms
-
unsure 🔍 -3% - +4%-0.55ms - +0.73ms
preact-main
16.14ms - 17.06ms
unsure 🔍 -4% - +3%-0.73ms - +0.55ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
3.72ms - 3.72ms
-
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
preact-main
3.72ms - 3.72ms
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
-
replace1k
Browser: chrome-headless
Sample size: 100
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
61.56ms - 62.65ms
-
unsure 🔍 -1% - +2%-0.56ms - +1.04ms
preact-main
61.28ms - 62.45ms
unsure 🔍 -2% - +1%-1.04ms - +0.56ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
2.99ms - 2.99ms
-
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
preact-main
2.98ms - 2.99ms
unsure 🔍 -0% - +0%-0.00ms - +0.00ms
-
run-warmup-0
Version
Avg time
vs preact-local
vs preact-main
preact-local
25.04ms - 25.84ms
-
unsure 🔍 -2% - +2%-0.55ms - +0.61ms
preact-main
24.99ms - 25.83ms
unsure 🔍 -2% - +2%-0.61ms - +0.55ms
-
run-warmup-1
Version
Avg time
vs preact-local
vs preact-main
preact-local
31.77ms - 32.76ms
-
unsure 🔍 -2% - +2%-0.76ms - +0.62ms
preact-main
31.85ms - 32.82ms
unsure 🔍 -2% - +2%-0.62ms - +0.76ms
-
run-warmup-2
Version
Avg time
vs preact-local
vs preact-main
preact-local
31.31ms - 32.01ms
-
unsure 🔍 -2% - +2%-0.54ms - +0.48ms
preact-main
31.32ms - 32.06ms
unsure 🔍 -2% - +2%-0.48ms - +0.54ms
-
run-warmup-3
Version
Avg time
vs preact-local
vs preact-main
preact-local
24.49ms - 24.80ms
-
unsure 🔍 -1% - +1%-0.29ms - +0.18ms
preact-main
24.52ms - 24.88ms
unsure 🔍 -1% - +1%-0.18ms - +0.29ms
-
run-warmup-4
Version
Avg time
vs preact-local
vs preact-main
preact-local
26.04ms - 27.57ms
-
unsure 🔍 -2% - +6%-0.55ms - +1.57ms
preact-main
25.56ms - 27.02ms
unsure 🔍 -6% - +2%-1.57ms - +0.55ms
-
run-final
Version
Avg time
vs preact-local
vs preact-main
preact-local
20.48ms - 21.04ms
-
unsure 🔍 -1% - +3%-0.20ms - +0.60ms
preact-main
20.28ms - 20.85ms
unsure 🔍 -3% - +1%-0.60ms - +0.20ms
-
text-update
Browser: chrome-headless
Sample size: 240
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
2.10ms - 2.32ms
-
unsure 🔍 -4% - +11%-0.09ms - +0.23ms
preact-main
2.03ms - 2.26ms
unsure 🔍 -10% - +4%-0.23ms - +0.09ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
0.99ms - 1.02ms
-
unsure 🔍 -2% - +2%-0.02ms - +0.02ms
preact-main
0.99ms - 1.02ms
unsure 🔍 -2% - +2%-0.02ms - +0.02ms
-
todo
Browser: chrome-headless
Sample size: 50
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
31.34ms - 31.73ms
-
slower ❌ 0% - 2%0.09ms - 0.57ms
preact-main
31.08ms - 31.34ms
faster ✔ 0% - 2%0.09ms - 0.57ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
1.25ms - 1.26ms
-
unsure 🔍 -1% - +0%-0.01ms - +0.01ms
preact-main
1.25ms - 1.26ms
unsure 🔍 -0% - +1%-0.01ms - +0.01ms
-
update10th1k
Browser: chrome-headless
Sample size: 60
Built by: CI #5166
Commit: 86c70d6
duration
Version
Avg time
vs preact-local
vs preact-main
preact-local
32.16ms - 33.48ms
-
unsure 🔍 -4% - +2%-1.32ms - +0.79ms
preact-main
32.26ms - 33.90ms
unsure 🔍 -2% - +4%-0.79ms - +1.32ms
-
usedJSHeapSize
Version
Avg time
vs preact-local
vs preact-main
preact-local
2.94ms - 2.95ms
-
unsure 🔍 -0% - +0%-0.00ms - +0.01ms
preact-main
2.93ms - 2.94ms
unsure 🔍 -0% - +0%-0.01ms - +0.00ms
-
tachometer-reporter-action v2 for CI
Size Change: +105 B (+0.22%)
Total Size: 47.5 kB
Filename
Size
Change
dist/preact.js
4.71 kB
+37 B (+0.79%)
dist/preact.mjs
4.73 kB
+36 B (+0.77%)
dist/preact.umd.js
4.79 kB
+32 B (+0.67%)
ℹ️ View Unchanged
Filename
Size
compat/dist/compat.js
3.9 kB
compat/dist/compat.mjs
3.82 kB
compat/dist/compat.umd.js
3.95 kB
debug/dist/debug.js
3.9 kB
debug/dist/debug.mjs
3.9 kB
debug/dist/debug.umd.js
3.98 kB
devtools/dist/devtools.js
263 B
devtools/dist/devtools.mjs
273 B
devtools/dist/devtools.umd.js
348 B
hooks/dist/hooks.js
1.53 kB
hooks/dist/hooks.mjs
1.56 kB
hooks/dist/hooks.umd.js
1.6 kB
jsx-runtime/dist/jsxRuntime.js
892 B
jsx-runtime/dist/jsxRuntime.mjs
861 B
jsx-runtime/dist/jsxRuntime.umd.js
966 B
test-utils/dist/testUtils.js
473 B
test-utils/dist/testUtils.mjs
473 B
test-utils/dist/testUtils.umd.js
555 B
compressed-size-action
coverage: 99.535%. remained the same when pulling 86c70d6 on fix/xhtml-in-mathml into 8e3e4ce on main .
rschristian changed the titlejunk: Vitest doesn't run locally so I guess I'm testing in the CI fix: Support XHTML phrasing content in MathML token elements
Sep 28, 2025
The reason will be displayed to describe this comment to others. Learn more .
LGTM, nice fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})