UNPKG

unique-selector

Version:

Given a DOM node, return a unique CSS selector matching only that element

16 lines (14 loc) 241 B
/** * Returns the Tag of the element * @param { Object } element * @return { String } */ export function getID( el ) { const id = el.getAttribute( 'id' ); if( id !== null && id !== '') { return `#${id}`; } return null; }