Skip to content

Commit a4cfd2b

Browse files
committed
really fix IE9 setClass
1 parent f819514 commit a4cfd2b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/util/dom.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,20 @@ export function off (el, event, cb) {
168168
* In IE9, setAttribute('class') will result in empty class
169169
* if the element also has the :class attribute; However in
170170
* PhantomJS, setting `className` does not work on SVG elements...
171-
* So we have to do a conditional detection here.
171+
* So we have to do a conditional check here.
172+
*
173+
* @param {Element} el
174+
* @param {String} cls
172175
*/
173176

174-
const setClass = isIE9
175-
? function (el, cls) {
176-
/* istanbul ignore next */
177+
function setClass (el, cls) {
178+
/* istanbul ignore if */
179+
if (isIE9 && el.hasOwnProperty('className')) {
177180
el.className = cls
178-
}
179-
: function (el, cls) {
181+
} else {
180182
el.setAttribute('class', cls)
181183
}
184+
}
182185

183186
/**
184187
* Add class with compatibility for IE & SVG

0 commit comments

Comments
 (0)