[BUGFIX release]  Fix usage of document.body.contains

Closes #5088.