fix(compiler): don't scan media tags inside comments/scripts; DOM-check auto-start (#1938) (#1940)

The timing compiler scanned raw HTML with tag regexes that weren't
comment-aware, so a comment or script merely mentioning `<video>`/`<audio>`
was rewritten as a real element — injecting id/data-start/data-hf-auto-start
into the comment text. That phantom attribute then tripped the probe stage's
substring check (`html.includes("data-hf-auto-start")`), launching an
unnecessary browser probe on every render with an unexplained empty reasons list.

- Mask comments, <script>, and <style> regions before the tag scan, then
  restore them verbatim (compileTimingAttrs, extractResolvedMedia).
- Replace the probe's substring match with a DOM query
  (video[data-hf-auto-start]) and add "auto-start video(s)" to the reasons list.
This commit is contained in:
Miguel Ángel
2026-07-06 18:19:35 -04:00
committed by GitHub
parent afa7f292fb
commit 1a3330a972
4 changed files with 64 additions and 3 deletions
Binary file not shown.