Permalink
Browse files

Merge pull request #2 from alokmenghrajani/master

Fix bug in share button
  • Loading branch information...
2 parents 80b5f21 + 88a03e9 commit 4f0135311d5ad30b1d5d589155fb1940d6336dc8 @daaku daaku committed Mar 27, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/xfbml/tags/sharebutton.js
@@ -111,19 +111,27 @@ FB.subclass('XFBML.ShareButton', 'XFBML.Element', null, {
classStr = 'fb_button fb_button_small';
wrapperClass = 'fb_share_count_wrapper';
}
+
+ var a_id = FB.guid();
+
this.dom.innerHTML = FB.String.format(
- '<span class="{0}">{4}<a href="{1}" class="{2}" ' +
- 'onclick=\'FB.ui({6});return false;\'' +
+ '<span class="{0}">{4}<a id="{1}" class="{2}" ' +
'target="_blank">{3}</a>{5}</span>',
wrapperClass,
- this._href,
+ a_id,
classStr,
contentStr,
pre,
- post,
- FB.JSON.stringify({ method: 'stream.share', u: this._href })
+ post
);
+ var a = document.getElementById(a_id);
+ a.href = this._href;
+ a.onclick = function() {
+ FB.ui({ method: 'stream.share', u: this._href });
+ return false;
+ };
+
if (!skipRenderEvent) {
this.fire('render');
}

0 comments on commit 4f01353

Please sign in to comment.