Home › Forums › General XMetaL Discussion › Get nodelist from Selection/Range? › Reply To: Get nodelist from Selection/Range?
Reply to: Get nodelist from Selection/Range?
September 12, 2012 at 6:19 pmSure. I'm working on a macro to enable cutting/pasting content as a conref. It was pretty easy to do this with a single element…with the cursor inside a given element, get Selection.ContainerNode, then do typical DOM stuff to add a conref to the clipboard. But what I want to do is extend that to also do conref range. Consider the following (assume all these elements have ids):
Paragraph 1, with some
Paragraph 2
Paragraph 3
Paragraph 4
Paragraph 5
If the following is selected:
Paragraph 2
Paragraph 3
Paragraph 4
I'd use the id from Paragraph 2 for the conref attribute, and the id from paragraph 4 for the conrefend attribute.
However, if I selected this:
some
Those would be error conditions. Those wouldn't be the only error conditions. The main thing is that I'd need to get a node list and look at it to see.