Lurker News

Comments (319) 80 threads

Show all comments

Showing thread 4 of 80

mavili2 replies#
This is insanely cool! Looks really slick too, even in a mobile screen.

jQuery?? I cannot imagine how difficult it is to not break this when you make the slightest change, hats off for managing with vanilla Javascript and jQuery! The best thing about React for me is to not have to worry about breaking the DOM or messing up with event handlers because some jQuery line, somewhere obscure is probably doing something funky that is really difficult to track down!

Intralexical1 reply#
Oh, wow. When this came up before, I don't know if I looked at the DOM, because I assumed you would do this type of thing by drawing pixels on a Canvas. It's actually made of HTML elements? That's impressive.
Aaronmacaron5 replies#
I too think it's very impressive but wouldn't it be even more impressive if it was made using canvas? It would mean that you would need to implement your own rendering loop and layout engine. You'd need to reimplement a lot of elements such as input fields or buttons. You get all of this for free when building on top of HTML/CSS.
noduerme#
You do get a lot of UI elements for free, but styling them consistently and getting them to layout properly becomes a lot more difficult.
Intralexical1 reply#
I think it would likely be more technically involved and complicated if it were made with `canvas`.

But large blobs drawing to `canvas` aren't anything new at this point. The part that impressed me is doing it the simple way, using what the browser already provides, and getting it to work this well.

Continue this thread — 1 reply

MatthiasPortzel#
It’s not performant if you’re using JavaScript APIs. But it’s also possible to write to a canvas with WebGL, which is hardware accelerated and is much faster than jQuery. I believe (although I can’t find a source for it now), that xterm.js used this strategy.
mrBurger#
I dunno, once you write the renderer, you essentially have no limits to worry about.

Working within the confines of HTML is way more impressive to me.

moffkalast#
That would be pretty slow, but with WebGL it could work.
tambourine_man1 reply#
You can easily shoot yourself in the foot with jQuery (or direct DOM manipulation for that matter), but it's not that hard not to. It just requires some discipline, like most things. React is also far from foolproof and not worth the added complexity in most cases, IMO.
smaudet3 replies#
Convention over Configuration.

That and types. The only framework that's useful to JS is a better static type check system (and none of this lets-make-the-whole-damn-runtime-slow to support X feature, looking at you TypeScript).

solumunus1 reply#
Curious which TS features you’re referring to?

Continue this thread — 1 reply

Dylan168079 replies#
> and none of this lets-make-the-whole-damn-runtime-slow to support X feature, looking at you TypeScript

TypeScript runtime? I don't think the deprecated code that sets up enum objects affects anything else...

Continue this thread — 9 replies

devjab5 replies#
We use a lot of typescript with a very opinionated setup on coding style and conventions, but that only goes so far when you’re dealing directly with the dom.

Because the dom is notoriously hard to work with. The internet is full of blog posts and articles talking about how slow it is as an example, but in reality adding or removing a dom node is swapping a pointers which is extremely fast. What is slow is things like “layout”. When Javascript changes something and hands control back to the browser it invokes its CSS recalc, layout, repaint and finally recomposition algorithms to redraw the screen. The layout algorithm is quite complex and it's synchronous, which makes it stupidly easy to make thing slow.
This is why the virtual dom of react “won”. Not because you can’t fuck up with it, but because it’s much harder to do so.

Continue this thread — 5 replies