Bug 840877 - Handle null undoManager in absence of documentElement. r=ehsan