fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-05-23 07:32 am

[dw-free] jQuery contexthover - '$parent.attr("href")' [undefined] is not an object.

[commit: http://hg.dwscoalition.org/dw-free/rev/bb0367f4a854]

http://bugs.dwscoalition.org/show_bug.cgi?id=3696

Sometimes there's no href tag, such as when we're in the entry title. So fix
the logic around that.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.contextualhover.js
--------------------------------------------------------------------------------
diff -r 32574be403a3 -r bb0367f4a854 htdocs/js/jquery.contextualhover.js
--- a/htdocs/js/jquery.contextualhover.js	Sat May 21 00:08:18 2011 +0800
+++ b/htdocs/js/jquery.contextualhover.js	Mon May 23 15:32:26 2011 +0800
@@ -20,10 +20,10 @@
             // if the parent (a tag with link to userinfo) has userid in its URL, then
             // this is an openid user icon and we should use the userid
             var $head = $(this);
-            var $parent = $head.parent("a[href]");
+            var href = $head.parent("a").attr("href");
             var data = {};
             var userid;
-            if (userid = $parent.attr("href").match(/\?userid=(\d+)/i))
+            if (href && (userid = href.match(/\?userid=(\d+)/i)))
                 data.userid = userid[1];
             else
                 data.username = $usertag.attr("lj:user");
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org