unique-selector

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

npm install unique-selector
1 downloads in the last day
1 downloads in the last week
6 downloads in the last month

unique-selector

Build Status

Given a DOM node, return a unique CSS selector matching only that element. This is particularly useful when tracking in custom variables in analytics:

document.addEventListener('click', function(event) {
    var selector = unique(event.target);

    _gaq.push(['_trackEvent', 'Engagement', 'Click', selector]);
}, false);

Installation

component install ericclemmons/unique-selector

Tests

$ npm install
$ make
$ open test/index.html

Releases

  • v0.0.2

    • Fix bug with nth-child calculuation
  • v0.0.1

    • Initial release

License

MIT

npm loves you