Element styles should be invalidated when they depend on CSS variables defined in one of their ancesors or when one of their ancestors change their class, due to the possibility of adding new CSS variables in scope.