function getDOMRangeRect(nativeSelection, rootElement) {
    const domRange = nativeSelection.getRangeAt(0);
    let rect;
    if (nativeSelection.anchorNode === rootElement) {
        let inner = rootElement;
        while(null != inner.firstElementChild)inner = inner.firstElementChild;
        rect = inner.getBoundingClientRect();
    } else rect = domRange.getBoundingClientRect();
    return rect;
}
export { getDOMRangeRect };
