That seems sensible.

I think the reasoning behind not using `root` is that we can safely make the assumption that this code is always going to be run in a browser so using `root` instead of `window` is unnecessary complexity.