static setElementSelection(element, start, end = null) {
        if (this.isUndefinedOrNullOrEmpty(end)) {
            end = start;
        }

        if (this.isInputElement(element)) {
            element.setSelectionRange(start, end);
        } else if (!AutoNumericHelper.isNull(element.firstChild)) {
            const range = document.createRange();
            range.setStart(element.firstChild, start);
            range.setEnd(element.firstChild, end);
            const selection = window.getSelection();
            selection.removeAllRanges();
            selection.addRange(range);
        }
    }
Cross browser routine for setting selected range/cursor position

@param {HTMLInputElement|EventTarget} element
@param {int} start
@param {int|null} end