Skip to content

Conversation

@lukewarlow
Copy link
Contributor

…moved

Setting innerHTML to an empty string violates Trusted Types. This changes to using textContent tp empty element children.

Fixes #4934

…moved

Setting innerHTML to an empty string violates Trusted Types.
This changes to using textContent tp empty element children.
@github-actions
Copy link

github-actions bot commented Oct 24, 2025

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -0% - +1% (-4.14ms - +5.31ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.04ms - +0.03ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +3% (-1.05ms - +2.53ms)
    preact-local vs preact-main
  • many-updates: slower ❌ 0% - 4% (0.08ms - 0.70ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -2% - +1% (-1.57ms - +0.68ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +13% (-0.02ms - +0.26ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +0% (-0.76ms - +0.14ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -5% - +2% (-1.27ms - +0.43ms)
    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.01ms - +0.00ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +12% (-0.07ms - +0.73ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -3% - +1% (-0.03ms - +0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local964.06ms - 971.04ms-unsure 🔍
-0% - +1%
-4.14ms - +5.31ms
preact-main963.78ms - 970.15msunsure 🔍
-1% - +0%
-5.31ms - +4.14ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.04ms - 19.04ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main19.04ms - 19.04msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.54ms - 16.59ms-unsure 🔍
-0% - +0%
-0.04ms - +0.03ms
preact-main16.55ms - 16.60msunsure 🔍
-0% - +0%
-0.03ms - +0.04ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.54ms - 1.54ms-unsure 🔍
-0% - +0%
-0.01ms - +0.00ms
preact-main1.54ms - 1.54msunsure 🔍
-0% - +0%
-0.00ms - +0.01ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local78.25ms - 80.34ms-unsure 🔍
-1% - +3%
-1.05ms - +2.53ms
preact-main77.10ms - 80.00msunsure 🔍
-3% - +1%
-2.53ms - +1.05ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local6.23ms - 6.82ms-unsure 🔍
-1% - +12%
-0.07ms - +0.73ms
preact-main5.92ms - 6.46msunsure 🔍
-11% - +1%
-0.73ms - +0.07ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.20ms - 16.67ms-slower ❌
0% - 4%
0.08ms - 0.70ms
preact-main15.85ms - 16.24msfaster ✔
1% - 4%
0.08ms - 0.70ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.72ms - 3.73ms-unsure 🔍
-0% - +0%
-0.01ms - +0.00ms
preact-main3.72ms - 3.73msunsure 🔍
-0% - +0%
-0.00ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #5173
  • Commit: 41fc35e

duration

VersionAvg timevs preact-localvs preact-main
preact-local65.79ms - 67.29ms-unsure 🔍
-2% - +1%
-1.57ms - +0.68ms
preact-main66.15ms - 67.82msunsure 🔍
-1% - +2%
-0.68ms - +1.57ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.99ms - 2.99ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main2.99ms - 2.99msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local25.53ms - 26.31ms-unsure 🔍
-3% - +1%
-0.79ms - +0.34ms
preact-main25.74ms - 26.55msunsure 🔍
-1% - +3%
-0.34ms - +0.79ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local32.17ms - 33.10ms-unsure 🔍
-3% - +1%
-1.05ms - +0.29ms
preact-main32.54ms - 33.49msunsure 🔍
-1% - +3%
-0.29ms - +1.05ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local32.54ms - 33.33ms-unsure 🔍
-3% - +1%
-0.92ms - +0.25ms
preact-main32.84ms - 33.70msunsure 🔍
-1% - +3%
-0.25ms - +0.92ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local25.44ms - 25.84ms-unsure 🔍
-4% - +0%
-0.99ms - +0.11ms
preact-main25.56ms - 26.59msunsure 🔍
-0% - +4%
-0.11ms - +0.99ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local25.23ms - 26.87ms-unsure 🔍
-8% - +0%
-2.28ms - +0.09ms
preact-main26.29ms - 27.99msunsure 🔍
-0% - +9%
-0.09ms - +2.28ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local21.11ms - 21.64ms-unsure 🔍
-1% - +2%
-0.31ms - +0.43ms
preact-main21.05ms - 21.57msunsure 🔍
-2% - +1%
-0.43ms - +0.31ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 240
  • Built by: CI #5173
  • Commit: 41fc35e

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.04ms - 2.25ms-unsure 🔍
-1% - +13%
-0.02ms - +0.26ms
preact-main1.93ms - 2.12msunsure 🔍
-12% - +1%
-0.26ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local0.99ms - 1.02ms-unsure 🔍
-3% - +1%
-0.03ms - +0.01ms
preact-main1.00ms - 1.03msunsure 🔍
-1% - +3%
-0.01ms - +0.03ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local30.79ms - 31.12ms-unsure 🔍
-2% - +0%
-0.76ms - +0.14ms
preact-main30.85ms - 31.68msunsure 🔍
-0% - +2%
-0.14ms - +0.76ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.25ms - 1.26ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main1.25ms - 1.25msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local25.78ms - 26.93ms-unsure 🔍
-5% - +2%
-1.27ms - +0.43ms
preact-main26.15ms - 27.40msunsure 🔍
-2% - +5%
-0.43ms - +1.27ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.93ms - 2.94ms-unsure 🔍
-0% - +0%
-0.01ms - +0.00ms
preact-main2.94ms - 2.94msunsure 🔍
-0% - +0%
-0.00ms - +0.01ms
-

tachometer-reporter-action v2 for CI

@coveralls
Copy link

Coverage Status

coverage: 99.535%. remained the same
when pulling 41fc35e on lukewarlow:fix-tt-violation
into 078ed0e on preactjs:main.

@lukewarlow
Copy link
Contributor Author

No new test because tests such as 'should apply proper mutation for VNodes with dangerouslySetInnerHTML attr' already cover this (if you change the empty string to 'foo' for example it fails.

newVNode._children = [];
} else {
if (oldHtml) dom.innerHTML = '';
if (oldHtml) dom.textContent = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to have a test for the trusted HTML case if that's possible at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conditional dangerouslySetInnerHTML triggers Trusted Types violation

3 participants