function _getMarkerAtDocumentPos(editor, pos, preferParent, markCache) {
        var marks, match;

        markCache = markCache || {};
        marks = _getSortedTagMarks(editor._codeMirror.findMarksAt(pos), markCache);
        if (!marks.length) {
            return null;
        }

        // The mark with the latest start is the innermost one.
        match = marks.pop();
        if (preferParent) {
            // If the match is exactly at the edge of the range and preferParent is set,
            // we want to pop upwards. If pos is exactly between two marks, we need to pop upwards twice.
            while (match && (_posEq(match.range.from, pos) || _posEq(match.range.to, pos))) {
                match = marks.pop();
            }
        }

        return match && match.mark;
    }
@private
Finds the mark for the DOM node at the given position in the editor.
@param {Editor} editor The editor containing the instrumented document.
@param {{line: number, ch: number}} pos The position to find the DOM marker for.
@param {boolean} preferParent If true, and the pos is at one or the other edge of the
    innermost marked range, return the immediately enclosing mark instead.
@param {Object=} markCache An optional cache to look up positions of existing
    markers. (This avoids calling the find() operation on marks multiple times,
    which is expensive.)
@return {Object} The CodeMirror mark object that represents the DOM node at the
    given position.