question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Element.prototype.classList: Multiple class names

See original GitHub issue

There’s a bug in IE 10-11 and Firefox < 24 with multiple class names:

element.classList.add('class1', 'class2');

Need a test case Possible solution

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
triblondoncommented, Mar 18, 2016

I moved the tangential discussion, but the multiple classnames remains unresolved. Since we no longer have variants, using Eli grey’s polyfill would be simple enough, so I’d suggest replacing the existing polyfill with that.

0reactions
JakeChampioncommented, Nov 21, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to add/remove several classes in one single ...
createElement('div'), dtp = DOMTokenList.prototype, toggle = dtp.toggle, add = dtp.add, rem = dtp.remove; ...
Read more >
Element.classList - Web APIs | MDN
The Element.classList is a read-only property that returns a live DOMTokenList collection of the class attributes of the element.
Read more >
Add and remove multiple classes in JavaScript for DOM element
The classList property should be your primary way to work with classes in JavaScript. The classList property has add() and remove() methods that ......
Read more >
HTML DOM Element classList Property - W3Schools
The classList property returns the CSS classnames of an element. ... Add multiple classes to the an element: element.classList.add("myStyle", "anotherClass" ...
Read more >
Add multiple classes to an Element using JavaScript
To add multiple classes to an element, select the element and pass multiple classes to the classList.add() method, e.g. box.classList.add('bg-blue', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found