export default function getClosestTitleElement(element) {
    let titleElement = null;
    if (element.hasAttribute('data-title') || element.hasAttribute('title')) {
        titleElement = element;
    } else {
        let closedTitleElement = element.closest('[data-title]') || element.closest('[title]');
        if (closedTitleElement) {
            titleElement = closedTitleElement;
        }
    }
    return titleElement;
}