Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4cfd2b

Browse filesBrowse files
committed
really fix IE9 setClass
1 parent f819514 commit a4cfd2b
Copy full SHA for a4cfd2b

File tree

Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-6
lines changed

‎src/util/dom.js

Copy file name to clipboardExpand all lines: src/util/dom.js
+9-6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.