Give root element a class based on the tail's position

What do you think of this? I did it this way instead of just resetting the class because in flow there are a few instances where the root has classes added later and I didn't want to delete them and cause breakage. (RequestAnimation at-top at-bottom classes, for example)

If you don't like it we can possibly change those instances where that happens instead.