Better JS DOM Building With DOM-JON — Part 3 : The State Object

Jason Knight
CodeX
Published in
25 min readApr 24, 2024

--

This time right out of the gate I’m going to jump right to the money shot with the current beta release and some examples. It’s a beta because it’s now “feature complete”. Everything I wanted in it for “base functionality” is now present and seems to work. Now for the joys of reliability testing.

Here’s a link to the current beta release.
https://cutcodedown.com/for_others/domjon/domjon.beta1.js

And a minified copy is here:
https://cutcodedown.com/for_others/domjon/domjon.beta1.min.js

The minification is a simple whitespace strip because a lot of the more modern JS techniques/methods, as well as my own methodology seems to be incompatible with most existing “fancy” minification. When simply removing unnecessary whitespace results in a library that min + gzipped is under 5k? I’m ok with that.

Comedy gold is that Google’s “Closure Compiler” by removing “unnecessary” curly brackets actually screws over the “let/const to replace IIFE” technique! Even in their so-called “whitespace only” setting… that strips and changes a whole slew of shit that isn’t whitespace. Talk about “try hard”.

Anyhow I don’t know about you folks, but I learn better from examples.

Example #1, Simple State Monitoring

--

--

Jason Knight
CodeX

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse