Skip to content

Commit 747a628

Browse files
committed
use className instead of setAttribute in IE9 (fix #1946)
1 parent 076e3f1 commit 747a628

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/dom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function addClass (el, cls) {
176176
} else {
177177
var cur = ' ' + (el.getAttribute('class') || '') + ' '
178178
if (cur.indexOf(' ' + cls + ' ') < 0) {
179-
el.setAttribute('class', (cur + cls).trim())
179+
el.className = (cur + cls).trim()
180180
}
181181
}
182182
}
@@ -197,7 +197,7 @@ export function removeClass (el, cls) {
197197
while (cur.indexOf(tar) >= 0) {
198198
cur = cur.replace(tar, ' ')
199199
}
200-
el.setAttribute('class', cur.trim())
200+
el.className = cur.trim()
201201
}
202202
if (!el.className) {
203203
el.removeAttribute('class')

0 commit comments

Comments
 (0)