Given an element contained in a shadow root, how can I get to the element that hosts the said shadow root? Is there a single way to accomplish this regardless of where an element is in the tree (i.e. given a reference to either element2
or element3
, get the reference to element1
)?
element1
└ #shadow-root
└ element2
└ element3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…