electerious / basicLightbox

The lightest lightbox ever made.
https://basiclightbox.electerious.com
MIT License
564 stars 55 forks source link

Can't add multiple classes with className #13

Closed usame-algan closed 6 years ago

usame-algan commented 6 years ago

Im trying to pass multiple classes to className like this:

className: 'class1 class2'

But getting the following error:

DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided ('class1 class2') contains HTML space characters, which are not valid in tokens.

Is there something Im missing? An option would be using the Spread Operator like shown here: https://stackoverflow.com/a/36486683/6085256

electerious commented 6 years ago

You're right. It should be .classList.add('a', 'b') instead of .classList.add('a b'). We could use the spread operator or a similar technique for this.

electerious commented 6 years ago

Fixed! https://github.com/electerious/basicLightbox/blob/master/CHANGELOG.md#403---2018-05-18