title: check if element is the root document inside shadow dom
body: <p>How can I check if for an element inside a shadow DOM, the element itself is the shadow root ?</p>
  
  <p>I tried <code>if (elem===elem.getRootNode())</code> but this doesn't work, as one is an element and one is a Node. </p>
  
  <p>What is the correct test ?</p>
  
  <p>My case is that I have code a Chrome extension that climbs up the DOM tree from a given element doing <code>elem = elem.parentElement</code> until <code>elem===document.documentElement</code>.</p>
  
  <p>I am now trying to extend the above test condition to work for elements inside shadow DOM. When climbing up from an element in a shadow DOM I want to end when reaching the root of the shadow DOM not the root of the entire page.</p>
  
  <p>I only need a Chrome solution.</p>