Get start tag pos from end tag pos

If I have some HTML, say:

<div>
  blah
</div>

I can get an array of start and end position values, if the cursor is within <div> using range = cm.fold[‘xml’](thisCM, pos).

Is it also possible to get these when the cursor is within </div>?

The xml-fold addon exports a CodeMirror.findMatchingTag(cm, pos) function that I think will help here.

Perfect - works great, many thanks.