I had a similar problem with the Pinterest button. This turned out to be a problem with the Pinterest pinit.js script.
Ive reported a Pinterest problem (login required) and they are looking at it.
We used the Pinterest button on the page with another link to it with the designated click event. Roughly speaking, an HTML link:
<a href="#" class="youCanClickThis"><span>Select</span></a>
The click event handler was as follows:
$('.youCanClickThis').click(function (e) { $(this).html('Selected'); });
This click handler somehow caused an error in pinit.js ( Uncaught TypeError: Cannot read property 'data-pin-log' of null ).
I unminified https://assets.pinterest.com/js/pinit.js to track error is easier. This showed up in this function in unminified pinit.js:
get: function (b, c) { var d = null; return d = typeof b[c] === "string" ? b[c] : b.getAttribute(c) },
In particular, typeof b[c] . get() is called from getData() , and the value of b is passed directly from anything called getData() . This turned out to be such a function:
click: function (b) { if ((b = afgetEl(b || awevent)) && b !== adb) { if (!afgetData(b, "log")) b = b.parentNode;
This works when a user clicks on something on a page with a Pinterest button. The final bit, b.parentNode , is what caused us problems.
At this point, b was assigned to the element on which the click event occurred. In our case, it was <span> inside <a> . However, since our JavaScript replaced the contents of the <a> tag with text, <span> no longer part of the document and therefore no longer had parentNode .
So b = b.parentNode caused b s to be null .
We worked on this without removing the <span> from the document when clicked. However, it would be nice if Pinterest could add a check to see if b.parentNode or something like that exists.
(I donβt understand the Pinterest script well enough to know what the best solution will be, but it is built with the assumption that the source of the click event will always have a parentNode , which, as this shows, is not a safe assumption).