MDL-37074 Assign theming: Use addClass/removeClass instead of setAttribute to preserv...
authorDamyon Wiese <damyon@moodle.com>
Fri, 8 Feb 2013 07:16:47 +0000 (15:16 +0800)
committerDamyon Wiese <damyon@moodle.com>
Fri, 8 Feb 2013 07:20:34 +0000 (15:20 +0800)
mod/assign/module.js

index ec5e071..4dc88b8 100644 (file)
@@ -24,17 +24,21 @@ M.mod_assign.init_grading_table = function(Y) {
             node.on('change', function(e) {
                 rowelement = e.currentTarget.get('parentNode').get('parentNode');
                 if (e.currentTarget.get('checked')) {
-                    rowelement.setAttribute('class', 'selectedrow');
+                    rowelement.removeClass('unselectedrow');
+                    rowelement.addClass('selectedrow');
                 } else {
-                    rowelement.setAttribute('class', 'unselectedrow');
+                    rowelement.removeClass('selectedrow');
+                    rowelement.addClass('unselectedrow');
                 }
             });
 
             rowelement = node.get('parentNode').get('parentNode');
             if (node.get('checked')) {
-                rowelement.setAttribute('class', 'selectedrow');
+                rowelement.removeClass('unselectedrow');
+                rowelement.addClass('selectedrow');
             } else {
-                rowelement.setAttribute('class', 'unselectedrow');
+                rowelement.removeClass('selectedrow');
+                rowelement.addClass('unselectedrow');
             }
         });
 
@@ -46,14 +50,16 @@ M.mod_assign.init_grading_table = function(Y) {
                     checkboxes.each(function(node) {
                         rowelement = node.get('parentNode').get('parentNode');
                         node.set('checked', true);
-                        rowelement.setAttribute('class', 'selectedrow');
+                        rowelement.removeClass('unselectedrow');
+                        rowelement.addClass('selectedrow');
                     });
                 } else {
                     checkboxes = Y.all('td.c0 input');
                     checkboxes.each(function(node) {
                         rowelement = node.get('parentNode').get('parentNode');
                         node.set('checked', false);
-                        rowelement.setAttribute('class', 'unselectedrow');
+                        rowelement.removeClass('selectedrow');
+                        rowelement.addClass('unselectedrow');
                     });
                 }
             });