MDL-31903 course: Title on highlight and hide icon should be only added in ie
authorRajesh Taneja <rajesh@moodle.com>
Fri, 16 Mar 2012 07:05:27 +0000 (15:05 +0800)
committerSam Hemelryk <sam@moodle.com>
Sun, 25 Mar 2012 22:44:50 +0000 (11:44 +1300)
lib/ajax/section_classes.js

index 4140f09..ab127f3 100644 (file)
@@ -337,7 +337,10 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
         YAHOO.util.Dom.removeClass(this.getEl(), 'hidden');
         this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show/i, 'hide');
         this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strshow, strhide);
-        this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strshow, strhide); //IE hack.
+        // mk_button set title only in ie, so check before setting it
+        if (this.viewButton.childNodes[0].title) {
+            this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strshow, strhide); //IE hack.
+        }
         this.viewButton.title = this.viewButton.title.replace(strshow, strhide);
         this.hidden = false;
 
@@ -353,7 +356,9 @@ section_class.prototype.toggle_hide = function(e,target,superficial) {
         YAHOO.util.Dom.addClass(this.getEl(), 'hidden');
         this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide/i, 'show');
         this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strhide, strshow);
-        this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strhide, strshow); //IE hack.
+        if (this.viewButton.childNodes[0].title) {
+            this.viewButton.childNodes[0].title = this.viewButton.childNodes[0].title.replace(strhide, strshow); //IE hack.
+        }
         this.viewButton.title = this.viewButton.title.replace(strhide, strshow);
         this.hidden = true;
 
@@ -376,14 +381,19 @@ section_class.prototype.toggle_highlight = function() {
         YAHOO.util.Dom.removeClass(this.getEl(), 'current');
         this.highlightButton.childNodes[0].src = main.portal.icons['marker'];
         this.highlightButton.childNodes[0].alt = strmarker;
-        this.highlightButton.childNodes[0].title = strmarker;   //for IE
+        // mk_button set title only in ie, so check before setting it
+        if (this.highlightButton.childNodes[0].title) {
+            this.highlightButton.childNodes[0].title = strmarker;   //for IE
+        }
         this.highlightButton.title = strmarker;
         this.highlighted = false;
     } else {
         YAHOO.util.Dom.addClass(this.getEl(), 'current');
         this.highlightButton.childNodes[0].src = main.portal.icons['marked'];
         this.highlightButton.childNodes[0].alt = strmarked;
-        this.highlightButton.childNodes[0].title = strmarked;   //for IE
+        if (this.highlightButton.childNodes[0].title) {
+            this.highlightButton.childNodes[0].title = strmarked;   //for IE
+        }
         this.highlightButton.title = strmarked;
         this.highlighted = true;
     }