-
Notifications
You must be signed in to change notification settings - Fork 4.5k
iAPI Router: Preserve media attribute on initial style sheets after client-side navigation #70668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iAPI Router: Preserve media attribute on initial style sheets after client-side navigation #70668
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +7 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…ient-side navigation (#70668) * Add failing test * Add extra failing test * Only update mediaText when necessary * Update changelog -------- Co-authored-by: DAreRodz <darerodz@git.wordpress.org> Co-authored-by: luisherranz <luisherranz@git.wordpress.org>
I just cherry-picked this PR to the release/21.2 branch to get it included in the next release: b0ef755 |
…ient-side navigation (#70668) * Add failing test * Add extra failing test * Only update mediaText when necessary * Update changelog -------- Co-authored-by: DAreRodz <darerodz@git.wordpress.org> Co-authored-by: luisherranz <luisherranz@git.wordpress.org>
What?
Fixes a bug with style sheets present on the initial page that have a specific
media
attribute, e.g.,media="print"
. Themedia
attribute in this case was overridden and unexpectedly set toall
.How?
These changes make the style management logic update the
element.sheet.media.mediaText
property only when its value ispreload
. For elements with any other value, the algorithm considers that the correct media value is already set.Testing Instructions
There are unit tests and e2e tests for this case.
It can also be tested by adding a
<style>
element with amedia="print"
attribute to the initial page and ensuring that those styles are not applied on the page after client-side navigation.