fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-03-29 08:41 pm

[dw-free] Use of reserved words "for", "class" as keys causes JS to break in Saf

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

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

Quote reserved words to be safe.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.commentmanage.js
--------------------------------------------------------------------------------
diff -r 4d14d369c518 -r a11dedf1db2d htdocs/js/jquery.commentmanage.js
--- a/htdocs/js/jquery.commentmanage.js	Tue Mar 29 18:04:11 2011 +0800
+++ b/htdocs/js/jquery.commentmanage.js	Wed Mar 30 04:41:25 2011 +0800
@@ -247,7 +247,7 @@
                             var id = "popdel"+self.linkdata.id+"ban";
                             ul.append($("<li>").append(
                                 $("<input>", { type: "checkbox", value: "ban", id: id}),
-                                $("<label>", { for: id }).html("Ban <strong>"+cmtdata.u+"</strong> from commenting")
+                                $("<label>", { "for": id }).html("Ban <strong>"+cmtdata.u+"</strong> from commenting")
                             ));
                         }
 
@@ -255,7 +255,7 @@
                             var id = "popdel"+self.linkdata.id+"spam";
                             ul.append($("<li>").append(
                                 $("<input>", { type: "checkbox", value: "spam", id: id}),
-                                $("<label>", { for: id }).text("Mark this comment as spam")
+                                $("<label>", { "for": id }).text("Mark this comment as spam")
                             ));
                         }
 
@@ -263,11 +263,11 @@
                             var id = "popdel"+self.linkdata.id+"thread";
                             ul.append($("<li>").append(
                                 $("<input>", { type: "checkbox", value: "thread", id: id}),
-                                $("<label>", { for: id }).text("Delete thread (all subcomments)")
+                                $("<label>", { "for": id }).text("Delete thread (all subcomments)")
                             ));
                         }
 
-                        ul.append($("<li>", { class: "submit" }).append(
+                        ul.append($("<li>", { "class": "submit" }).append(
                             $("<input>", { type: "button", value: "Delete"})
                                 .click(deletecomment),
 
--------------------------------------------------------------------------------