When an element is hosted in <template>.content, its .parentNode will be a DocumentFragment, and the fragment's .host will be undefined.
When an element is hosted in a shadowRoot, its .parentNode will be a DocumentFragment, and the fragment's .host will be the shadowRoot owner element 🎉
https://github.com/GoogleChrome/accessibility-developer-tools/pull/338 actually provided support for elements hosted in a shadow root, not a
<template>
. This PR makes it more clear & updates the tests accordingly.When an element is hosted in
<template>.content
, its.parentNode
will be aDocumentFragment
, and the fragment's.host
will beundefined
. When an element is hosted in ashadowRoot
, its.parentNode
will be aDocumentFragment
, and the fragment's.host
will be the shadowRoot owner element 🎉