-
-
Notifications
You must be signed in to change notification settings - Fork 384
Styles should not be inserted into HEAD in Safari #492
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
Styles should not be inserted into HEAD in Safari #492
Comments
@evilebottnawi i could pr it appending to the body instead. Or an option could be added to the plugin like ‘appendTo’ thoughts? |
First one has to investigate the consequences. Plus should new |
@theKashey It is not just style files but js files too could cause the whole rendering suspended. The dom is acutally loaded (we can examine it in the devtools). Should this be reported to webkit? |
I would say - it might take a year to resolve this issue via webkit, so some other solution should be created. |
inserting styles to |
That's not how you should think about it. Now "what everybody is doing it", but "why everybody is doing it". And really - there is no reason. For example all CSS-in-JS solution during SSR insert styles or links just before markup, and that's ok. There is no real reason to hoist everything to the All existing studies, proposing keeping "styles in the head" are:
|
The reason is to start to load CSS as much faster as we can, because CSSOM is blocking JS parsing. |
Again, you are speaking about SSR case, but this (JavaScript!) plugin is adding them when application is already half running. In the original issue (code splitting) - when you change your route - everything is already parsed, everything is loaded. |
You can fix it using #609, I think we can close it, because it is not good default behavior, but if you provide more information we can improve it out of box |
|
Expected Behavior
Expected that application behaviour would be the same across different browsers.
Actual Behavior
In
Safari
the whole rendering would be suspended whilestyle
, added to thehead
, is loading.Adding
style
to thebody
resolves the problem.Code
This example reproduces an issue originally created for loadable-components.
It delays serving for
.css
file for 10 second, and all this time nothing is rendered.How Do We Reproduce?
link
to thehead
in Safarylink
is loading the dataHow to fix?
For Safari "dynamic" styles has to be added into
Body
. It resolves the issue.The text was updated successfully, but these errors were encountered: