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