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

Function setClass

06.Router/basic/js/vue.js:1313–1320  ·  view source on GitHub ↗

* In IE9, setAttribute('class') will result in empty class * if the element also has the :class attribute; However in * PhantomJS, setting `className` does not work on SVG elements... * So we have to do a conditional check here. * * @param {Element} el * @param {String} cls

(el, cls)

Source from the content-addressed store, hash-verified

1311 */
1312
1313 function setClass(el, cls) {
1314 /* istanbul ignore if */
1315 if (isIE9 && !/svg$/.test(el.namespaceURI)) {
1316 el.className = cls;
1317 } else {
1318 el.setAttribute('class', cls);
1319 }
1320 }
1321
1322 /**
1323 * Add class with compatibility for IE & SVG

Callers 3

addClassFunction · 0.70
removeClassFunction · 0.70
vue.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected