classList.js icon indicating copy to clipboard operation
classList.js copied to clipboard

add() function with no arguments

Open ShiningDan opened this issue 6 years ago • 3 comments

Hello, I am a little confused when using the add function in classList.js. If I pass no argument to add, just like: element.classList.add(), the element class will add "undefined" to the end.

This is because the source code using token = tokens[i] + ""; to generate className "undefined" , but in HTML5 classList property, element.classList.add() will not affect the class name.

Of course this is an easy bug to fix, I am wondering if it is some kind of features so you leave it the way? Or it is just a bug :)

Sorry for my poor English and looking forward to your reply.

ShiningDan avatar Sep 16 '17 13:09 ShiningDan

This is a valid bug and I will look into it at a later time

eligrey avatar Dec 10 '17 10:12 eligrey

@eligrey I can fix that if you don't mind

dolgachio avatar Dec 15 '17 09:12 dolgachio

We're experiencing the same issue, I'm also happy to take a look at it.

dominique-mueller avatar Oct 18 '18 13:10 dominique-mueller