* Remove class with compatibility for SVG since classList is not supported on * SVG elements in IE
(el, cls)
| 6161 | * SVG elements in IE |
| 6162 | */ |
| 6163 | function removeClass (el, cls) { |
| 6164 | /* istanbul ignore if */ |
| 6165 | if (!cls || !(cls = cls.trim())) { |
| 6166 | return |
| 6167 | } |
| 6168 | |
| 6169 | /* istanbul ignore else */ |
| 6170 | if (el.classList) { |
| 6171 | if (cls.indexOf(' ') > -1) { |
| 6172 | cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); }); |
| 6173 | } else { |
| 6174 | el.classList.remove(cls); |
| 6175 | } |
| 6176 | } else { |
| 6177 | var cur = " " + (el.getAttribute('class') || '') + " "; |
| 6178 | var tar = ' ' + cls + ' '; |
| 6179 | while (cur.indexOf(tar) >= 0) { |
| 6180 | cur = cur.replace(tar, ' '); |
| 6181 | } |
| 6182 | el.setAttribute('class', cur.trim()); |
| 6183 | } |
| 6184 | } |
| 6185 | |
| 6186 | /* */ |
| 6187 |
no test coverage detected