I can't see how a bunch of esoteric incantations are better than just some straight-forward easy to understand and follow JavaScript.
Because a team of browser engineers have already written and reviewed the code to do it for you; and (hopefully) it’ll be performant, properly tested and accessible… ;-D
You’ve described software.