[HN Gopher] Show HN: BDC - Ergonomic, sub 1KiB virtual DOM library
___________________________________________________________________
Show HN: BDC - Ergonomic, sub 1KiB virtual DOM library
BDC is a simple library for updating the DOM to match a javascript
description. Does not require JSX or a compilation step.
clobber( document.body, h("marquee", [
h("span", {"style": "font-weight: bold"}, "Hello"), ", ",
h("blink", "world"), "!", ]), ); Very fast
to first render, moderately slow on subsequent updates. Prompted
by the post on millionjs, which compiles user code to hit the same
outrageously small size target.
Author : bwhmather
Score : 20 points
Date : 2022-07-31 07:17 UTC (1 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| sod wrote:
| I always wonder why github doesn't do something like this. Right
| now they return html via ajax and innerHTML it into the DOM.
| Given that innerHTML is notoriously slow, returning something
| like this should be way faster.
|
| Your lib seems to lack svg & @types support though. And I don't
| know why you have "virtual DOM" in the title, given that it has
| nothing to do with it :)
| klysm wrote:
| Just rails things
| chrismorgan wrote:
| You know what's slower than setting innerHTML? Doing just what
| setting innerHTML would have done, but bit by bit.
|
| If you're changing from one thing to another _very similar_
| thing, then doing precise edits makes sense. But if you're
| changing structure significantly, then doing precise edits will
| be slower than just clobbering it all by setting innerHTML.
| sxspartshouse wrote:
___________________________________________________________________
(page generated 2022-08-01 23:02 UTC)