The getHTML() method of the ShadowRoot interface is used to serialize a shadow root's DOM to an HTML string.
getHTML()
MDN Reference