据我研究过,只能将元素插入阴影主机内的阴影dom。
示例:
<div id="myShadowHost"><h1>This is my host</h1></div>
<script>
//attach a shadow to myShadowHost
var myHost=document.querySelector('#myShadowHost').createShadowRoot();
//Declare an insertion point
var content = document.createElement('content');
//select element to pull into the insertion point, in this case the h1
content.setAttribute('select', 'h1');
//append to shadowHost the insertion point and pulled element.
myHost.appendChild(content);
</script>`
最终,我想进入阴影主机之外的阴影元素。