Skip to content

Commit

Permalink
really fix IE9 setClass
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 4, 2015
1 parent f819514 commit a4cfd2b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/util/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,20 @@ export function off (el, event, cb) {
* 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 detection here.
* So we have to do a conditional check here.
*
* @param {Element} el
* @param {String} cls
*/

const setClass = isIE9
? function (el, cls) {
/* istanbul ignore next */
function setClass (el, cls) {
/* istanbul ignore if */
if (isIE9 && el.hasOwnProperty('className')) {
el.className = cls
}
: function (el, cls) {
} else {
el.setAttribute('class', cls)
}
}

/**
* Add class with compatibility for IE & SVG
Expand Down

0 comments on commit a4cfd2b

Please sign in to comment.