Comment

Comment by simonw

After reading the tutorial at https://vanjs.org/tutorial I was about to open an issue suggesting that they include constants with the SVG and MathML namespace, so that this:

    const {circle, path, svg} = van.tagsNS("http://www.w3.org/2000/svg")
    const {math, mi, mn, mo, mrow, msup} = van.tagsNS("http://www.w3.org/1998/Math/MathML")
Could be expressed like this instead:

    const {circle, path, svg} = van.tagsNS(van.SVG)
    const {math, mi, mn, mo, mrow, msup} = van.tagsNS(van.MathML)
... then I looked at the code at https://cdn.jsdelivr.net/gh/vanjs-org/van/public/van-1.2.7.m... and realized that adding those constants would increase the size from 1729 to 1806 bytes - a 4.45% increase for a feature most people would never use.

This thing is tight!

Just for fun, I ran their minified code through ChatGPT to see if it could deobfuscate it. It did a pretty good job of guessing sensible variable names for things: https://chat.openai.com/share/9dac0b13-7b24-409a-9cc1-494667...

parent simonw 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton