{"action":"created","issue":{"url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/19","labels_url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/19/comments","events_url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/19/events","html_url":"https://github.com/ellisonleao/sharer.js/pull/19","id":128893034,"number":19,"title":"Use `currentTarget` instead to make sure listener fires on element","user":{"login":"lleger","id":52359,"avatar_url":"https://avatars.githubusercontent.com/u/52359?v=3","gravatar_id":"","url":"https://api.github.com/users/lleger","html_url":"https://github.com/lleger","followers_url":"https://api.github.com/users/lleger/followers","following_url":"https://api.github.com/users/lleger/following{/other_user}","gists_url":"https://api.github.com/users/lleger/gists{/gist_id}","starred_url":"https://api.github.com/users/lleger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lleger/subscriptions","organizations_url":"https://api.github.com/users/lleger/orgs","repos_url":"https://api.github.com/users/lleger/repos","events_url":"https://api.github.com/users/lleger/events{/privacy}","received_events_url":"https://api.github.com/users/lleger/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-26T17:54:03Z","updated_at":"2016-01-26T17:58:55Z","closed_at":"2016-01-26T17:58:43Z","pull_request":{"url":"https://api.github.com/repos/ellisonleao/sharer.js/pulls/19","html_url":"https://github.com/ellisonleao/sharer.js/pull/19","diff_url":"https://github.com/ellisonleao/sharer.js/pull/19.diff","patch_url":"https://github.com/ellisonleao/sharer.js/pull/19.patch"},"body":"When the sharing handler attached to an element containing another\r\nelement (e.g. button containing an icon), the sharing functionality\r\nwouldn't fire because the handler was firing on the child elements\r\ninstead of the sharer element.\r\n\r\nFor example, this wouldn't work:\r\n\r\n```\r\n<button class=\"sharer button\" data-sharer=\"twitter\" data-title=\"Checkout\r\nSharer.js!\" data-via=\"ellisonleao\" data-hashtags=\"awesome, sharer.js\"\r\ndata-url=\"https://ellisonleao.github.io/sharer.js/\"><span>Share on\r\nTwitter</span></button>\r\n```\r\n\r\nThis commit resolves that issue by using `Event.currentTarget` instead\r\nof `Event.target`. From the [docs]:\r\n\r\n> Identifies the current target for the event, as the event traverses\r\n> the DOM. It always refers to the element the event handler has been\r\n> attached to as opposed to event.target which identifies the element on\r\n> which the event occurred.\r\n\r\nThis always gives us the element that the sharer was attached to as\r\nopposed to any children elements, which is what we want.\r\n\r\n[docs]:\r\nhttps://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget"},"comment":{"url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/comments/175144041","html_url":"https://github.com/ellisonleao/sharer.js/pull/19#issuecomment-175144041","issue_url":"https://api.github.com/repos/ellisonleao/sharer.js/issues/19","id":175144041,"user":{"login":"ellisonleao","id":178641,"avatar_url":"https://avatars.githubusercontent.com/u/178641?v=3","gravatar_id":"","url":"https://api.github.com/users/ellisonleao","html_url":"https://github.com/ellisonleao","followers_url":"https://api.github.com/users/ellisonleao/followers","following_url":"https://api.github.com/users/ellisonleao/following{/other_user}","gists_url":"https://api.github.com/users/ellisonleao/gists{/gist_id}","starred_url":"https://api.github.com/users/ellisonleao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ellisonleao/subscriptions","organizations_url":"https://api.github.com/users/ellisonleao/orgs","repos_url":"https://api.github.com/users/ellisonleao/repos","events_url":"https://api.github.com/users/ellisonleao/events{/privacy}","received_events_url":"https://api.github.com/users/ellisonleao/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T17:58:55Z","updated_at":"2016-01-26T17:58:55Z","body":"nice catch @lleger ! Thanks :beers: !"}}