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

Function addClass

static/vuejs/vue.js:6138–6157  ·  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

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

Callers 15

addTransitionClassFunction · 0.70
vue.jsFile · 0.70
wrappingChangedFunction · 0.50
initScrollbarsFunction · 0.50
showCrossHairFunction · 0.50
onFocusFunction · 0.50
codemirror.min.jsFile · 0.50
wrappingChangedFunction · 0.50
initScrollbarsFunction · 0.50
showCrossHairFunction · 0.50
onFocusFunction · 0.50
codemirror.jsFile · 0.50

Calls 2

getAttributeMethod · 0.80
setAttributeMethod · 0.45

Tested by

no test coverage detected