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

Function addClass

static/vuejs/vue.common.js:6144–6163  ·  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

6142 * SVG elements in IE
6143 */
6144function addClass (el, cls) {
6145 /* istanbul ignore if */
6146 if (!cls || !(cls = cls.trim())) {
6147 return
6148 }
6149
6150 /* istanbul ignore else */
6151 if (el.classList) {
6152 if (cls.indexOf(' ') > -1) {
6153 cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
6154 } else {
6155 el.classList.add(cls);
6156 }
6157 } else {
6158 var cur = " " + (el.getAttribute('class') || '') + " ";
6159 if (cur.indexOf(' ' + cls + ' ') < 0) {
6160 el.setAttribute('class', (cur + cls).trim());
6161 }
6162 }
6163}
6164
6165/**
6166 * Remove class with compatibility for SVG since classList is not supported on

Callers 2

addTransitionClassFunction · 0.70
vue.common.jsFile · 0.70

Calls 2

getAttributeMethod · 0.80
setAttributeMethod · 0.45

Tested by

no test coverage detected