unique-selector
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.4
- Handle extra whitespace in
className
(#9)
- Handle extra whitespace in
-
v0.0.3
- Add support for various
<form>
elements (#2)
- Add support for various
-
v0.0.2
- Fix bug with
nth-child
calculation
- Fix bug with
-
v0.0.1
- Initial release
License
MIT