Does CSS new 'content-visibility' property interfere with scripts loading behavior?

It would be <footer style="content-visibility:auto"> not <footer content-visibility="auto">.

It's a CSS property, so it won't affect script loading, but because it has the potential to affect the layout, script execution could be affected if it, for example, relied on a particular layout based operation such as getting the bounding box of a rectangle.


As you consider Alohci's answer as incomplete, I'll add my 2 cents, but mostly I can only rephrase that what already been said.

I don't have Chrome 85, so I can't test it. But after reading the specs this and this I think that:

  1. ...but if It was a script that adds a handler to an element, it may be faulty, like $(selector).click(...) ?

    Just test it! Try clicking an element with content-visibility: auto with JS code while it's still invisible due to being off-screen. I'm sure handler will work. There is nothing in the specs about such matters.

  2. Will the content-visibility property interfere with script loading in any way?

    No. There is not a word about resource loading in the specs. But again - test it! Look at the Network tab. Script's load sequence shouldn't change.

  3. So, it won't affect scripts that are of general use, like bootstrap and such, but [what] if it was a script that...

    ...a script that...

    • somehow depends on the size of element with content-visibility: auto or it descendants (Alohci already pointed it out)
    • somehow depends on innerText
    • related to some accessibility features (possibly... not really familiar with these)
    • and in some other cases (read the spec if you're interested in the details)
    • and there can be other cases not mentioned in the specs as the feature is still in it's infancy. (And the content-visibility's spec is actually a draft)

    Yes it can break

    You can even imaging a script that reads css properties, finds content-visibility and throws as it's unknown to it... or even throws just because it's author hates those who use content-visibility :)

    But I think that in your case the chances are infinitesimal, as I suppose that non of the scripts you're referring to are interested in your footer.

Anyway, any change should be tested (ideally). But also you can never be sure that there are no bugs. So just just try it, if it's worth it, and see how it goes.