eligrey / eligrey/classList.js

add() function with no arguments

Open
#72 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
226
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.