Uses document.contains to figure if element exists in the DOM

addresses issue raised in
https://github.com/Polymer/ShadowDOM/issues/365#issuecomment-33509711