MCPcopy Create free account
hub / github.com/TruthHun/BookStack / addClass

Function addClass

static/vuejs/vue.runtime.esm.js:5694–5713  ·  view source on GitHub ↗

* Add class with compatibility for SVG since classList is not supported on * SVG elements in IE

(el, cls)

Source from the content-addressed store, hash-verified

5692 * SVG elements in IE
5693 */
5694function addClass (el, cls) {
5695 /* istanbul ignore if */
5696 if (!cls || !(cls = cls.trim())) {
5697 return
5698 }
5699
5700 /* istanbul ignore else */
5701 if (el.classList) {
5702 if (cls.indexOf(' ') > -1) {
5703 cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
5704 } else {
5705 el.classList.add(cls);
5706 }
5707 } else {
5708 var cur = " " + (el.getAttribute('class') || '') + " ";
5709 if (cur.indexOf(' ' + cls + ' ') < 0) {
5710 el.setAttribute('class', (cur + cls).trim());
5711 }
5712 }
5713}
5714
5715/**
5716 * Remove class with compatibility for SVG since classList is not supported on

Callers 2

addTransitionClassFunction · 0.70
vue.runtime.esm.jsFile · 0.70

Calls 2

getAttributeMethod · 0.80
setAttributeMethod · 0.45

Tested by

no test coverage detected