Again, consider using something other than window. document.documentElement may be good.