Re:Native Javascript alternatives to jQuery methods
by lucideer on Monday April 01, 2019 @02:19PM
(#19546398)
It's worded as "alternatives", not "equivalents", so API parity isn't a requirement.
The fact that `classList.add` has a different interface to `$.fn.addClass` isn't really a big deal—this would be the case with most migrations from one API to another without matching interfaces. The question is of internal functionality—the only thing jQuery "adds" here is being lenient about the param type accepted.
> - Doesn't arbitrarily transform property names
Ok, would you then prefer to reimplement the vendor-prefixing logic on your own or just not support browsers that only support the vendor-prefixed version of a property?
I can see your point, and in some ways I agree with that "philosophy", but my point was that I wouldn't personally call these functions "jQuery alternative" in this context, as the 2 are pretty different beasts.