Javascript error in share_widget_link.js
Gribnif - May 6, 2009 - 20:06
| Project: | Share |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Description
I was getting a Javascript error in share_widget_link.js because the jQuery selector $("li.share_" + share.shareID + "_" + share.nid) does not return any results. So the attached patch not only prevents the error, but it corrects the selector so that results are returned.
| Attachment | Size |
|---|---|
| share_widget_link.patch | 662 bytes |

#1
the 'li' is needed to differentiate link share widgets from node and block share widgets. Though I do like the use of the continue, I'll implement that.
#2
I think that may be part of the reason why the original code did not work for me. In my links, I don't have any "li" tags, just "a". There is an outer
<div class="links">, so perhaps you could change the selector to$(".links>a.link-share_" + share.shareID + "_" + share.nid)and have it work in all cases.#3
I take back what I said. I now see how default themes like Garland are different from mine. This version seems to work for both:
$(".links a#share-" + share.shareID + "-" + share.nid)#4
I updated my custom theme_links function to more closely match the one in Drupal 6, and now this change isn't needed. I had been using one that was based on Drupal 5's code, which did not use UL and LI tags.