We never set  styleFunction of vector sources, the styleFunction is always set to the feature directly in our usecases, that's why we test only if a layer's styleFunction exist and not a source's styleFunction