UnjQuerify is a project that can assist developers in migrating code from jQuery to vanilla DOM APIs.
In:
$("#submit").click(function() {
$("#output").text("The button was clicked!");
$(".post").hide();
});Output:
document.getElementById("submit").addEventListener("click", function () {
document.getElementById("output").textContent = "The button was clicked!";
document.getElementsByClassName("post").map((_element) => _element.style.display = "none");
});babelto build an AST and to transform nodes.
- Ensure that
npmis available. - Use
npm installto install dependencies. - Run unjQuerify with the provided example script:
npm --silent start sample/simple.js. - Verify that the console shows the transformed script.
- Ensure that
npmis available. - Run
npm install unjquerify. - Import unjQuerify's plugins using `require('unjquerify/build/src/all-plugins')`` or a similar method.
Contributions are always welcome. Please see this project's issue tracker.
Some useful resources are the following:
Before submitting a pull request, please verify that your changes pass linting (run with npm run lint). Please include tests for new features.