Bug 1023618 - Ensure that win.document.documentElement exists before using it. r=roc