fix: handle missing style container - #811
Conversation
|
@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. Walkthrough本次变更为动态 CSS 操作增加空容器保护。 Changes动态 CSS 容器安全处理
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change makes CSS injection and removal tolerate transient documents without a head or body while preserving valid-container insertion behavior; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
nullwhen style injection runs during a transient document state with neither<head>nor<body>updateCSS, removal, and container-sync paths without changing insertion order for valid containersinjectCSSandupdateCSSwith regressions that remove and then restore the document style containersCloses #603.
Why a new fix
The older #455 exact head (
903dfe1) still throws atcontainer.appendChild(styleNode)for both public paths. It also skips insertion for prepend mode when a valid container is empty, becauseinsertBefore(styleNode, null)was replaced with a conditional. This PR keeps the standard empty-container insertion behavior and returns early only when the container itself is absent. I left the exact-head reproduction details on #455.Verification
d1045f4:injectCSSfails atfirstChild;updateCSSfails atchildren903dfe1: both paths fail atappendChildnpm test -- --runInBand: 29 suites passed; 184 passed, 1 skippednpm run tsc: passednpm run lint: 0 errors, 13 pre-existing unused-disable warningsgit diff --check: passedOverlap audit
#455 targets the same issue but is incomplete as described above. #809 also touches these two files for the independent Trusted Types
textContentchange; it does not address missing containers. This change can be rebased after either PR lands if needed.AI assistance disclosure
Codex was used to trace the failure paths, audit overlapping open PRs, implement and run the regression tests, and draft this description. All reported failures and verification results were executed locally against the cited commits.
Summary by CodeRabbit