Event API - empty evt.data.element in most cases.

jasonstoltz May 21, 2012 01:28PM EDT

In the "evt" object passed to the event handlers in this scenario, evt.data.element is an empty object. The desired behavior that I believe is supposed to happen is that it should contain a reference to the "anchor" tag that was used to create it.

The problem with the element field NOT being populated, is that there is no way to tell WHICH addthis bar on the page was used. Since the events API is global, reading the element field is the ONLY way that I have found that allows us to differentiate.

This is fairly critical for metrics reporting. Can this be fixed? Or do you have a workaround? Thanks in advance!

Here's my addthis:
<div class="addthis_toolbox addthis_default_style ">
<a customatt="value1" class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a customatt="value1" class="addthis_button_tweet" tw:lang="en"></a>
<a customatt="value1" class="addthis_button_pinterest_pinit" pi:pinit:media="https://encrypted-tbn3.google.com/images?q=tbn:ANd9GcR6rmpn6QMkwNFcMbAV4cImQdHuN5eggqraYgEs4jVbXL4-gjPS" pi:pinit:layout="horizontal"></a>
<a customatt="value1" class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>

Here's my event:
addthis.addEventListener('addthis.menu.share', function(evt){if (evt.type == 'addthis.menu.share') {
console.log(evt);
lastevent = evt;
}});

This question is closed to new answers.

Still need help?


General Topics

 

Developers