UNPKG

unique-selector

Version:

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

19 lines (17 loc) 328 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.getID = getID; /** * Returns the Tag of the element * @param { Object } element * @return { String } */ function getID(el) { var id = el.getAttribute('id'); if (id !== null && id !== '') { return '#' + id; } return null; }