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

Function addClass

01.GettingStarted/js/vue.js:1329–1338  ·  view source on GitHub ↗

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

(el, cls)

Source from the content-addressed store, hash-verified

1327 */
1328
1329 function addClass(el, cls) {
1330 if (el.classList) {
1331 el.classList.add(cls);
1332 } else {
1333 var cur = ' ' + getClass(el) + ' ';
1334 if (cur.indexOf(' ' + cls + ' ') < 0) {
1335 setClass(el, (cur + cls).trim());
1336 }
1337 }
1338 }
1339
1340 /**
1341 * Remove class with compatibility for IE & SVG

Callers 2

vue.jsFile · 0.70
mergeAttrsFunction · 0.70

Calls 2

getClassFunction · 0.70
setClassFunction · 0.70

Tested by

no test coverage detected