Updating enterView/leaveView callbacks to apply only to primary document...

The enterView/leaveView callbacks currently fire if the element is within its ownerDocument rather than in the view. This updates the inDocument check to apply to the top-level document.