fix(w3c): match CSS selectors used in base.css#5160
fix(w3c): match CSS selectors used in base.css#5160daniel-montalvo wants to merge 3 commits intospeced:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the W3C SoTD and header logic with the CSS class selectors used by W3C’s base.css for revised Recommendations, specifically around distinguishing candidate vs proposed additions/corrections.
Changes:
- Update SoTD logic to detect candidate additions/corrections using
.addition:not(.proposed)/.correction:not(.proposed). - Update W3C header validation logic to use
.addition.proposed/.correction.proposed(and exclude.proposedwhen checking for non-proposed revisions).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/w3c/templates/sotd.js | Fixes revision-detection selectors to distinguish proposed vs candidate changes. |
| src/w3c/headers.js | Updates revision-related selectors for updatable REC validations to match the class conventions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hasCorrections = | ||
| document.querySelector(".correction:not(.proposed)") !== null; | ||
| const hasProposedCorrections = | ||
| document.querySelector(".proposed-correction") !== null; | ||
| const hasAdditions = document.querySelector(".addition") !== null; | ||
| document.querySelector(".correction.proposed") !== null; | ||
| const hasAdditions = |
There was a problem hiding this comment.
Because hasAdditions/hasCorrections are now explicitly excluding .proposed, the later validation if (!isUpdatableRec && (hasAdditions || hasCorrections)) will no longer fire for documents that only contain proposed additions/corrections. That looks like a behavioral regression vs the previous .addition/.correction selectors, and it also makes the error text about "proposed additions" inconsistent with the condition. Consider including hasProposedAdditions/hasProposedCorrections in that check (and/or adjusting the message to match what the condition is actually validating).
There was a problem hiding this comment.
@copilot, can you add tests to expose this issue?
marcoscaceres
left a comment
There was a problem hiding this comment.
See what co-pilot said
Hi @marcoscaceres @sideshowbarker can you take a look at this one?
It contains a couple more mismatched selectors for revised recommendations that I forgot about in #5149