MCPcopy Index your code
hub / github.com/ygs-code/vue / removeClass

Function removeClass

vue.js:10877–10908  ·  view source on GitHub ↗

* Remove class with compatibility for SVG since classList is not supported on * SVG elements in IE *删除与SVG兼容的类,因为不支持类列表 * IE中的SVG元素 删除真实dom的css类名

(el, cls)

Source from the content-addressed store, hash-verified

10875 删除真实dom的css类名
10876 */
10877 function removeClass(el, cls) {
10878 /* istanbul ignore if */
10879 if (!cls || !(cls = cls.trim())) {
10880 return
10881 }
10882
10883 /* istanbul ignore else */
10884 if (el.classList) {
10885 if (cls.indexOf(' ') > -1) {
10886 cls.split(/\s+/).forEach(function (c) {
10887 return el.classList.remove(c);
10888 });
10889 } else {
10890 el.classList.remove(cls);
10891 }
10892 if (!el.classList.length) {
10893 el.removeAttribute('class');
10894 }
10895 } else {
10896 var cur = " " + (el.getAttribute('class') || '') + " ";
10897 var tar = ' ' + cls + ' ';
10898 while (cur.indexOf(tar) >= 0) {
10899 cur = cur.replace(tar, ' ');
10900 }
10901 cur = cur.trim();
10902 if (cur) {
10903 el.setAttribute('class', cur);
10904 } else {
10905 el.removeAttribute('class');
10906 }
10907 }
10908 }
10909
10910 /*
10911 *

Callers 2

removeTransitionClassFunction · 0.85
vue.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected