Close #5088 - Fix usage of document.body.contains

``` document.body.contains ``` is not supported by old Firefox browsers. This is a simple check whether browser support ```contains``` method before using it.