How can I tell who the parent node of a selection is?
I'm getting a selection with:
var userSelection;
if (window.getSelection) {
userSelection = window.getSelection();
}
else if (document.selection) {
userSelection = document.selection.createRange();
}
var selectedText = userSelection;
if (userSelection.text)
selectedText = userSelection.text;
But how can i tell who's the parent node of the selection? That is, if the whole selection is from withing a single div
I want to know that div.