I've believed that my problem is pretty simple but after spending some time searching I cannot find a satisfactory solution.
I have a DocumentFragment element and I want to check if it's wrapped entirely by some html tag. Here is pseudo code which I'm trying to turn into JavaScript:
entireTagSelected = function (selRange) {
var documentFragment = selRange.cloneContents();
if (documentFragment is wrapped entirely by something) {
return something;
}
return undefined;
}
For DocumentFragment like:
<span>Te<b>s</b>t</span>
the function should return span object.
But for fragments like:
Some text<span>Test</span>
it should return undefined.