document.contains is nonstandard; use document.body.contains