Guest User

Untitled

a guest
May 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // Click delegation (cross browser API's not accounted for)
  2. document.addEventListener('click', function (e) {
  3. if (e.target.tagName.toLowerCase() === 'a' && e.target.href) {
  4. /* execute tracking logic */
  5. }
  6. }, false);
  7.  
  8.  
  9. // Click delegation with YUI 3
  10. Y.one('doc').delegate("click", function (e) {
  11. /* execute tracking logic */
  12. }, "a[href]");
Add Comment
Please, Sign In to add comment