onDomRefresh should only trigger if the view.el is actually in the DOM

`onDomRefresh` never actually checked if the view.el was in the DOM, but just assumed it was based on events that had fired on the view (`show` and `render`).

This PR does an additional check in `onDomRefresh` against the DOM so we can guarantee it really is in the DOM.

FYI `document.documentElement` and `document.documentElement.contains(x)` should be [safe to use](http://www.quirksmode.org/dom/core/#miscellaneous).

Fixed #748 and fixes #479 and #505.