The first time I open a web, sometimes the style is broken. If I refresh it works again.

It's a random bug I found in several themes, including some of my own.
When I first open a website, the css theme is only partly loaded, and some aspects like the backgrounds are still like in the original web (irritating because I use stylish for dark themes). Simply reloading the web or navigating through its sections makes the theme working again... but if I leave and come back, or if I open a new tab in the web, the bug might happen again.

Are those CSS themes defectives or too complex to be loaded fully? (when I simplified my dark theme for the problem dissapeared)
...Or is it just a bug of the AddOn?


  • Yes, its the addon problem, use stylus instead
  • Thanks for the tip!
  • The problem is the style. The site and the user style are targeting some of the same elements with CSS selectors that have the same specificity. In that case the last rule loaded wins. Often this happens when a selector is copy+pasted from a site style into a user style.

    If the user style is loaded before the site style, then the site style wins those conflicts when it arrives. What you'll see is that some of your style rules are applied and some aren't.

    The first time you load a site there is no cached copy of the site's style. The user style is applied before the site style, and when the site style arrives it wins these conflicts. When you reload the page the site style is loaded (quickly) from a cached copy, the user style is applied after the site style, and the user style wins these conflicts.

    If you've disabled caching in your browser, or if the web site doesn't allow the site style to be cached, then this will happen more often. The browser will still keep a cached copy of the site style in memory until the last tab that uses it is closed (a bit longer really if memory allows, in case you return to the site with the "back" button), and while it does the user style will work as expected, but after that copy is gone the half-styled look will return. It does seem random if you don't know the cause.

    @_33_kk_: Why do you believe this doesn't affect Stylus? Do you have a reason, or just a strong partisan belief in the power of the fork?
  • Impossible to say for sure what OP's issue is without testing the style in question, but Stylish's injection is flakier in general. You can test it yourself by creating two styles in either extension which compete with the same specificity.

    Stylus will win the specificity battle because it ensures styles are always injected last, whereas Stylish isn't even consistent. Often times, they're even injected before the body.

  • edited August 2019 [?]
    o! said:

    @_33_kk_: Why do you believe this doesn't affect Stylus? Do you have a reason, or just a strong partisan belief in the power of the fork?

    Well, i don't. Just its still maintained and better overall. And as anagrammar said stylus injects css better so it probably would work with it.
Sign In or Register to comment.