I'm trying to convert an arbitrary string of markup into a DocumentFragment. The only method I know of to do that is insertParsedString(), with is a method on Range objects.
Unfortunately, I haven't been able to figure out how to attach a range to a fragment and make it work right. I've tried a few variations on the following theme:
var d = Application.activeDocument;
var f = d.createDocumentFragment();
var r = f.getOwnerDocument().createRange();
Doing that, I get a "paste would make in the pasted region out of context." I've also tried using the setStart() and setEnd() methods on range to no avail.
Does anyone have any advice?