|
12 | 12 | }(this, function(require,exports,module) { |
13 | 13 |
|
14 | 14 | (function() { |
15 | | - var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache, |
| 15 | + var Evented, addClass, defer, deferred, extend, flush, getBounds, getClassName, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, setClassName, uniqueId, updateClasses, zeroPosCache, |
16 | 16 | __hasProp = {}.hasOwnProperty, |
17 | 17 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, |
18 | 18 | __slice = [].slice; |
|
38 | 38 | if (style == null) { |
39 | 39 | return parent; |
40 | 40 | } |
41 | | - if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) { |
| 41 | + if (/(auto|scroll)/.test(style['overflow'] + style['overflowY'] + style['overflowX'])) { |
42 | 42 | if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) { |
43 | 43 | return parent; |
44 | 44 | } |
|
177 | 177 | }; |
178 | 178 |
|
179 | 179 | removeClass = function(el, name) { |
180 | | - var cls, _i, _len, _ref, _results; |
| 180 | + var className, cls, _i, _len, _ref, _results; |
181 | 181 | if (el.classList != null) { |
182 | 182 | _ref = name.split(' '); |
183 | 183 | _results = []; |
|
189 | 189 | } |
190 | 190 | return _results; |
191 | 191 | } else { |
192 | | - return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); |
| 192 | + className = getClassName(el).replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); |
| 193 | + return setClassName(el, className); |
193 | 194 | } |
194 | 195 | }; |
195 | 196 |
|
|
207 | 208 | return _results; |
208 | 209 | } else { |
209 | 210 | removeClass(el, name); |
210 | | - return el.className += " " + name; |
| 211 | + cls = getClassName(el) + (" " + name); |
| 212 | + return setClassName(el, cls); |
211 | 213 | } |
212 | 214 | }; |
213 | 215 |
|
214 | 216 | hasClass = function(el, name) { |
215 | 217 | if (el.classList != null) { |
216 | 218 | return el.classList.contains(name); |
217 | 219 | } else { |
218 | | - return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className); |
| 220 | + return new RegExp("(^| )" + name + "( |$)", 'gi').test(getClassName(el)); |
219 | 221 | } |
220 | 222 | }; |
221 | 223 |
|
| 224 | + getClassName = function(el) { |
| 225 | + if (el.className instanceof SVGAnimatedString) { |
| 226 | + return el.className.baseVal; |
| 227 | + } else { |
| 228 | + return el.className; |
| 229 | + } |
| 230 | + }; |
| 231 | + |
| 232 | + setClassName = function(el, className) { |
| 233 | + return el.setAttribute('class', className); |
| 234 | + }; |
| 235 | + |
222 | 236 | updateClasses = function(el, add, all) { |
223 | 237 | var cls, _i, _j, _len, _len1, _results; |
224 | 238 | for (_i = 0, _len = all.length; _i < _len; _i++) { |
|
0 commit comments