https://hyperscript.org/comparison/ [light_logo] docs reference cookbook talk sponsor github VanillaJS v. jQuery v. hyperscript Below are comparisons of how to implement various common UI patterns in vanilla javascript, jQuery and hyperscript. In general, the VanillaJS version will be the most awkward. The jQuery version will be better, but will separate the logic from the element in question. This is considered good practice by some people, in the name of separation of concerns, but it violates locality of behavior, which we feel is usually more important for system maintainability. (If you've ever had to hunt for an obscure event handler in jQuery, you know what we mean.) Both the VanillaJS and JQuery verisons will often require callbacks, making for awkward expression of logic that is straight-forward and linear in hyperscript. This becomes especially pronounced in more complex promise or callback chains. Comparisons * Fade And Remove * Fetch And Insert * Debounced Input * Toggle A Class * Trigger An Event * Show An Element Fade And Remove Pattern: fade and remove an element after it is clicked VanillaJS
Remove Me
Remove Me jQuery
Remove Me
Remove Me hyperscript
Remove Me
Remove Me Fetch And Insert Pattern: fetch some data and insert it into an element VanillaJS
Fetch It jQuery
Fetch It hyperscript
Fetch It Debounced Input Pattern: debounce event handling to avoid triggering logic in response to multiple, shortly spaced events VanillaJS
[ ] jQuery
[ ] hyperscript
[ ] Toggle A Class Pattern: toggle a class on another element when clicked VanillaJS
Toggle Class Toggle Target jQuery
Toggle Target
Toggle Class Toggle Target hyperscript
Toggle Target
Toggle Class Toggle Target Trigger An Event Pattern: trigger a custom event on another element in the DOM VanillaJS
Event Target
Trigger Event Event Target jQuery
Event Target
Trigger Event Event Target hyperscript
Event Target
Trigger Event Event Target Show An Element Make an element visible by setting the display style to block VanillaJS Show Element Hidden Element jQuery Show Element Hidden Element hyperscript Show Element Hidden Element