Repository navigation
fix(site-plan): treat an omitted stylesheet type as text/css when placing shared chrome - #3842
Merged
Merged
Conversation
…cing shared chrome
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.
Summary
Shared-chrome projections (rules lifted out of authored stylesheets to style the shared header and footer) get one slot per document per condition. The slot follows the last contributing stylesheet instance with that media/type/device condition (#3572).
The condition key compared
typeliterally. A source that links some stylesheets withtype="text/css"and others (or<style>blocks) without a type therefore got two unconditional slots for the same shared-chrome file. The file was enqueued twice under two handles on every page. An omitted type meanstext/css, so these are one condition.On a real sports federation site, the shared-chrome stylesheet is 1.1 MB, and every page loaded it twice.
What changed: when placing projections, the slot key normalizes
text/cssto an omitted type. The placed instance keeps the winning origin's own type attribute. As before, the slot follows the last contributing instance, so nothing changes in the cascade: the earlier copy was always overridden by the later identical one.Evidence
tests/unit/shared-chrome-projection-media-instances.php: a later chrome stylesheet linked withtype="text/css"is added.composer test:canonical,test:parity(352 fixtures),test:packaging, phpcs on the changed files, phpstan: all pass.AI assistance
The diagnosis, the fix and the test were done by Claude Opus (Pi via Roadie), with Chris's review and approval.