* Remove class with compatibility for SVG since classList is not supported on * SVG elements in IE
(el, cls)
| 5719 | * SVG elements in IE |
| 5720 | */ |
| 5721 | function removeClass (el, cls) { |
| 5722 | /* istanbul ignore if */ |
| 5723 | if (!cls || !(cls = cls.trim())) { |
| 5724 | return |
| 5725 | } |
| 5726 | |
| 5727 | /* istanbul ignore else */ |
| 5728 | if (el.classList) { |
| 5729 | if (cls.indexOf(' ') > -1) { |
| 5730 | cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); }); |
| 5731 | } else { |
| 5732 | el.classList.remove(cls); |
| 5733 | } |
| 5734 | } else { |
| 5735 | var cur = " " + (el.getAttribute('class') || '') + " "; |
| 5736 | var tar = ' ' + cls + ' '; |
| 5737 | while (cur.indexOf(tar) >= 0) { |
| 5738 | cur = cur.replace(tar, ' '); |
| 5739 | } |
| 5740 | el.setAttribute('class', cur.trim()); |
| 5741 | } |
| 5742 | } |
| 5743 | |
| 5744 | /* */ |
| 5745 |
no test coverage detected