Message from JavaScript discussions

March 2017

— Each page of the app should be in it's own persistent document fragment, then you can change it, then clone it into a DOM node and bam, that is the fastest possible way to interact with the page in js

Message permanent page


var myPage = document.createDocumentFragment();
var myContainer = myPage.createElement("div");

this creates a blazing fast docfrag that doesn't exist in the DOM, it gets changed extremely quickly, except this can be very cumbersome to write yourself so I reccomend a premade lib or framework to take some of the load off

— That is a virtual DOM by definition

— No react required

— A docfrag is literally the same principles as react's virtual dom, even

— I'll try to explain with situations which I face daily, we use Symfony in our company and we have created custom form types in Symfony using Twig and AngularJS, these form types are basically reusable components which do a lot of work from helping in generation of views to ajax requests. We just write one line of code to do all this stuff.

Message permanent page

— And comes with js

— Nice, I love component based systems like that

— So basically here scalability and reusability comes at cost of speed ( not that much though ) but it saves us ( devs) a lot of hours in which we can do other works

Message permanent page

— Disagree, compute is cheap

— And "performance is everything" and posting PHP snippets a few messages later is kinda... yeah, no

— Php7 is quite performant