refactor(core): route ReSpec's own style injection through insertStyle - #5447
Merged
Conversation
marcoscaceres
force-pushed
the
refactor/core-insert-style
branch
from
September 2, 2026 11:30
6d2ac24 to
1146b90
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The helper can insert ReSpec styles outside the document head when given a non-head anchor.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Centralizes ReSpec stylesheet injection through a shared helper.
Changes:
- Adds
insertStyle()for consistent style creation and placement. - Migrates 15 core modules to the helper.
- Preserves IDs, classes, CSS content, and ordering.
File summaries
| File | Description |
|---|---|
src/core/insert-style.js |
Adds shared style insertion helper. |
src/core/algorithms.js |
Uses shared helper. |
src/core/caniuse.js |
Preserves stylesheet metadata. |
src/core/cddl.js |
Centralizes anchored insertion. |
src/core/data-type.js |
Centralizes style injection. |
src/core/dfn-index.js |
Centralizes style injection. |
src/core/dfn-panel.js |
Centralizes anchored insertion. |
src/core/examples.js |
Centralizes anchored insertion. |
src/core/highlight-vars.js |
Centralizes style injection. |
src/core/highlight.js |
Replaces templated style creation. |
src/core/implementation-status.js |
Preserves stylesheet metadata. |
src/core/issues-notes.js |
Centralizes anchored insertion. |
src/core/mdn-annotation.js |
Centralizes style injection. |
src/core/style.js |
Removes its local helper. |
src/core/ui.js |
Removes its local helper. |
src/core/webidl.js |
Centralizes anchored insertion. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
Reviewed locally and here. I'm happy with this. It's a good little cleanup. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReSpec injected its own stylesheets from fifteen different places, each hand-rolling
createElement("style")or anhtmltemplate, including two near-identical localinsertStylehelpers incore/style.jsandcore/ui.js. This routes them all through onecore/insert-style.jswith no behavior change, verified by rendering the same spec with both bundles and diffing the resulting head: 31 children and 13 style elements, identical in id, class attribute, order and content.