MCPcopy Create free account
hub / github.com/keepfool/vue-tutorials / removeClass

Function removeClass

02.Components/Part-1/js/vue.js:1347–1361  ·  view source on GitHub ↗

* Remove class with compatibility for IE & SVG * * @param {Element} el * @param {String} cls

(el, cls)

Source from the content-addressed store, hash-verified

1345 */
1346
1347 function removeClass(el, cls) {
1348 if (el.classList) {
1349 el.classList.remove(cls);
1350 } else {
1351 var cur = ' ' + getClass(el) + ' ';
1352 var tar = ' ' + cls + ' ';
1353 while (cur.indexOf(tar) >= 0) {
1354 cur = cur.replace(tar, ' ');
1355 }
1356 setClass(el, cur.trim());
1357 }
1358 if (!el.className) {
1359 el.removeAttribute('class');
1360 }
1361 }
1362
1363 /**
1364 * Extract raw content inside an element into a temporary

Callers 1

vue.jsFile · 0.70

Calls 2

getClassFunction · 0.70
setClassFunction · 0.70

Tested by

no test coverage detected