Proposed fix for #13268

Fixes #13268.
Technique for checking "Is this in the DOM?" chosen based on [this perf test](http://jsperf.com/jquery-element-in-dom/2) from [this SO thread](http://stackoverflow.com/questions/3086068/how-do-i-check-whether-a-jquery-element-is-in-the-dom).