Can we use Element.classList or not?
See original GitHub issueI just want to ask whether we use Element.classList
or not. Cross-browser support is not perfect but it should be good enough.
I’m asking because I thought that we don’t use .classList
but plugins like Line numbers are sending mixed messages, so I’m not sure.
/cc @mAAdhaTTah
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Element.classList - Web APIs | MDN
classList is a read-only property that returns a live DOMTokenList collection of the class attributes of the element. This can then be used...
Read more >HTML DOM Element classList Property - W3Schools
The classList property returns the CSS classnames of an element. ... The classList property is read-only, but you can use the methods listed...
Read more >Check If an Element contains a Class - JavaScript Tutorial
This tutorial shows you how to check if an element contains a specific class using JavaScript DOM API.
Read more >Literally Everything You Need To Know About classList
JavaScript classList seems straightforward, but there are actually multiple unique methods you probably don't know.
Read more >Check if an element contains a class in JavaScript?
Use element.classList .contains method: element.classList.contains(class);. This works on all current browsers and there are polyfills to support older ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
True, but I’m not a fan of adding polyfills to core features. If we are to drop old IE compatibility then we don’t have to bother too much about this (but we could list this polyfill in an appropriate section of the readme). And if we were to keep old IE compatibility, adding this polyfill would still require a major version bump.
Oh, and now I just saw an issue where we speak about dropping IE11 support. Haha we might not be compatible with IE9 at all, actually. I don’t know anymore. A major version with explicit browser support (at least in the readme) would be great.