Skip to content
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

Replace the <link> without flashing the css #257

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

mariusGundersen
Copy link
Contributor

@mariusGundersen mariusGundersen commented Oct 11, 2024

This fixes the flash of unstyled content (FOUC) by inserting the new stylesheet before the old one is removed.

Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for anchor-position-wpt canceled.

Name Link
🔨 Latest commit 7db4ac9
🔍 Latest deploy log https://app.netlify.com/sites/anchor-position-wpt/deploys/670cda24856c6400084f168e

Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for anchor-polyfill ready!

Name Link
🔨 Latest commit 7db4ac9
🔍 Latest deploy log https://app.netlify.com/sites/anchor-polyfill/deploys/670cda24a55fee0008fedb3a
😎 Deploy Preview https://deploy-preview-257--anchor-polyfill.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@jamesnw jamesnw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think this makes sense. Thanks for this! The momentary double styles will be less impactful than momentary no styles.

The only change I see is with the tests, which I think will be easy to fix- it looks like since both links are in the DOM, querySelector selects the old one, so the load event is called on the wrong element.

@jgerigmeyer jgerigmeyer linked an issue Oct 11, 2024 that may be closed by this pull request
Copy link
Contributor

@jamesnw jamesnw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change fixed the tests. Thanks for this contribution!

@jamesnw jamesnw merged commit 2c69cc0 into oddbird:main Oct 14, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] at loading time the polyfill make the website « blink »
3 participants