Converting Range or DocumentFragment to string
So, how to get the string of the html of a Range or DocFrag? Contrary to the other responses, it is possible to directly turn a DocumentFragment object into a DOMString using the XMLSerializer.prototype.serializeToString method described at https://w3c.github.io/DOM-Parsing/#the-xmlserializer-interface. To get the DOMString of a Range object, simply convert it to a DocumentFragment using either of … Read more