// GetShadowRoot retrieves the shadowRoot connected to the pass dom.Node, else // returns false as the second argument if the node has no shadowRoot. func GetShadowRoot(elem dom.Node) (dom.DocumentFragment, bool) { if elem == nil { return nil, false } var root *js.Object if root = elem.Underlying().Get("shadowRoot"); root == nil { if root = elem.Underlying().Get("root"); root == nil { return nil, false } } return dom.WrapDocumentFragment(root), true }
// ShadowRootDocument returns the DocumentFragment interface for the provided // shadowRoot. func ShadowRootDocument(elem dom.Node) dom.DocumentFragment { rs := RootElement(elem) return dom.WrapDocumentFragment(rs.Underlying()) }