seznam / JAK

JAK je kompaktní a jednoduchý systém volně provázaných knihoven, usnadňující práci v prostředí jazyka JavaScript.
Other
49 stars 29 forks source link

change className to getAttribute/setAttribute in classList to support SVG elements #148

Closed Greld closed 7 years ago

Greld commented 7 years ago

className on SVG elements returns SVGAnimatedString object, but we expect a string value. To get a string every time, we can use getAttribute instead.

aichi commented 7 years ago

Are you still supporting browsers which doesn't have classList?

Greld commented 7 years ago

classList is not supported in IE11 and older for SVG elements. http://caniuse.com/#search=classList

ondras commented 7 years ago

Are you still supporting browsers which doesn't have classList?

IE9, baby ;-)

classList is not supported in IE11 and older for SVG elements.

This is a multi-polyfill. Includes:

  1. classList for IE8/9;
  2. DOMTokenList on SVGElement.prototype for IE10/11;
  3. DOMTokenList.prototype.{add,remove} with multiple arguments for browsers that support only one;
  4. DOMTokenList.prototype.toggle with optional second argument for browsers that support only one.
ondras commented 7 years ago

className on SVG elements returns SVGAnimatedString object, but we expect a string value. To get a string every time, we can use getAttribute instead.

This has to be fixed here: https://github.com/seznam/JAK/blob/master/lib/polyfills/classList.js

The resulting jak.js is a result of running make in the project directory.

Greld commented 7 years ago

It should be ok now.

ondras commented 7 years ago

Thanks!