can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19783: LJSUP-9574: Not working Delete as Spam i...

Committer: dpetrov
LJSUP-9574: Not working Delete as Spam in Inbox
U   trunk/htdocs/js/esn_inbox.js
Modified: trunk/htdocs/js/esn_inbox.js
===================================================================
--- trunk/htdocs/js/esn_inbox.js	2011-08-19 07:04:01 UTC (rev 19782)
+++ trunk/htdocs/js/esn_inbox.js	2011-08-19 08:09:04 UTC (rev 19783)
@@ -158,6 +158,8 @@
 
 // set up inbox buttons
 ESN_Inbox.initInboxBtns = function (folder, cur_folder) {
+
+    var delItem, markSpam;
     // 2 instances of action buttons
     for (var i=1; i<=2; i++) {
         if( $(folder + "_MarkRead_" + i) ) {
@@ -166,14 +168,19 @@
         if( $(folder + "_MarkUnread_" + i) ) {
             DOM.addEventListener($(folder + "_MarkUnread_" + i), "click", function(e) { ESN_Inbox.markUnread(e, folder) });
         }
-        if( $(folder + "_Delete_" + i) ) {
-            DOM.addEventListener($(folder + "_Delete_" + i), "click", function(e) { ESN_Inbox.deleteItems(e, this, folder) });
+
+        //we use bind because DOM.addEventListener doesn't handle differences in the this value in different browsers
+        delItem = $(folder + "_Delete_" + i);
+        if( delItem ) {
+            DOM.addEventListener(delItem, "click", (function(e) { ESN_Inbox.deleteItems(e, this, folder) }).bind(delItem));
         }
         if( $(folder + "_UnSpam_" + i) ) {
             DOM.addEventListener($(folder + "_UnSpam_" + i), "click", function(e) { ESN_Inbox.markRead(e, folder) });
         }
-        if( $(folder + "_Spam_" + i) ) {
-            DOM.addEventListener($(folder + "_Spam_" + i), "click", function(e) { ESN_Inbox.markSpam(e, this, folder) });
+
+        markSpam = $(folder + "_Spam_" + i);
+        if( markSpam ) {
+            DOM.addEventListener(markSpam, "click", (function(e) { ESN_Inbox.markSpam(e, this, folder) }).bind(markSpam));
         }
     }
 

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments