But my original code makes sure that styling is applied before slider progress range is inserted into the slider.

Your code does reduce code duplication, but the range is adjusted after it has been placed into DOM. Minor visual flicker (the DIV changing its dimensions, QUICKLY) will be visible to the user.