Make inDom check of tooltip cross document compatible

Fixes #14483