2 ms·
Sure, the native APIs are slowly catching up, and classList is definitely a useful one. You'd better hope that there actually is an element with an ID of "foo"
by bshimmin 12y ago
Sure, the native APIs are slowly catching up, and classList is definitely a useful one.
You'd better hope that there actually is an element with an ID of "foo", though, otherwise your example will throw an exception. The last time I pointed this out here, there was some disagreement as to whether jQuery's behaviour is actually desirable. I think it is, but I'm probably biased from writing too much jQuery over the years.