Skip to content

Commit

Permalink
IE 8 does NOT support classList, yay
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Nov 19, 2016
1 parent 5a1b3d4 commit 919ddaa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions media/system/js/calendar-vanilla.js
Expand Up @@ -61,6 +61,10 @@ JoomlaCalendar.addClass = function(el, className) {
el.className += " " + className;
};

JoomlaCalendar.hasClass = function(element, cls) {
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
};

JoomlaCalendar.stopEvent = function(ev) {
ev || (ev = window.event);
if (JoomlaCalendar.is_ie) {
Expand Down Expand Up @@ -142,13 +146,13 @@ JoomlaCalendar.dayMouseDown = function(ev) {
} else {
// No - try to find the table this way
el = el.getParent('TD');
if (el.classList.contains('dropdown-menu')) {
if (JoomlaCalendar.hasClass(el, 'dropdown-menu')) {
el = el.getElementsByTagName('table');
}
}
} else {
// Check that the td doesn't have a bootstrap button in it (and is not a day td) - if so ingore the event
if (!(target.classList.contains('btn')) && !el.classList.contains('day') && !el.classList.contains('title')) {
if (!(JoomlaCalendar.hasClass(target, 'btn')) && !JoomlaCalendar.hasClass(el,'day') && !JoomlaCalendar.hasClass(el, 'title')) {
return;
}
}
Expand Down Expand Up @@ -309,7 +313,7 @@ JoomlaCalendar.cellClick = function(el, ev) {
ev && cal.callHandler();
}
if (closing) {
el.classList.remove("hilite");
JoomlaCalendar.removeClass(el, "hilite");
ev && cal.callCloseHandler();
}
};
Expand Down Expand Up @@ -853,7 +857,7 @@ JoomlaCalendar.prototype._toggleMultipleDate = function(date) {
cell.removeClass("table-success");
this.multiple[ds] = date;
} else {
cell.classList.remove("selected");
JoomlaCalendar.removeClass(cell, "selected");
JoomlaCalendar.addClass(cell, "table-success alert-success");
delete this.multiple[ds];
}
Expand Down Expand Up @@ -953,8 +957,8 @@ JoomlaCalendar.prototype.show = function () {
var cells = row.getElementsByTagName("td");
for (var j = cells.length; j > 0;) {
var cell = cells[--j];
cell.classList.remove('alert-info');
cell.classList.remove('alert-success');
JoomlaCalendar.removeClass(cell, 'alert-info');
JoomlaCalendar.removeClass(cell, 'alert-success');
}
}
this.element.style.display = "block";
Expand Down

0 comments on commit 919ddaa

Please sign in to comment.