I've been tasked with converting a substantial amount of jQuery to vanilla JS. Grinding through and changing each line by hand is of course an option, but I wanted to see if something has already been done to automate the process.
Converting selectors and simple jQuery calls seems simple enough, but other conveniences introduced by jQuery make conversion non-trivial. An example being the ability to subscript additional methods after each call:
// jQuery element.addClass('one two three').removeClass('four five').css('left', '100px'); // Vanilla JS equivalent element.classList.add('one', 'two', 'three') element.classList.remove('four', 'five') element.style.left = '100px';
Making a script using regex to find jQuery and converting it seems like a viable option, but is also not a small undertaking with all the edge cases that can occur.