Git Product home page Git Product logo

Comments (3)

mjesun avatar mjesun commented on May 7, 2024

Would it be possible to combine this with #50? I know from the examples provided that patching a DOM tree that does not have __incrementalDOMData is possible. My idea is to inject the HTML generated by such interface via innerHTML. The benefits I see are:

  • Faster DOM node creation for an initial pass.
  • Would mitigate problems with <input> and type definition for IE8 (most of the times, type is kept constant, so just initializing it correctly the first time would solve the issue, see #60).
  • As stated in #50, this would also let you render in the server.

In any case, if this is the used approach, I think I would let this outside the standard incremental DOM implementation, so the library keeps its small size.

from incremental-dom.

sparhami avatar sparhami commented on May 7, 2024

Lots of good points. I had experimented with generating innerHTML'd strings a while ago. Some things to consider:

  • If you are attaching things that are properties (e.g. extra objects you want to store), you may want to do a normal diff pass shortly after the initial render
  • innerHTML is faster, but not hugely faster than pure createElement and setAttribute (something like 25% if I recall correctly)
  • Need to have logic to escape attribute values and text nodes, in the worst case (lots of text data), this can be a significant amount of time and may cause pure createElement to be faster (a bit fuzzy on this one but I think that is what I saw)

As you said, it should probably be outside the core library. I'm not sure if this repo would be a good place (considering #141) or if perhaps it should be another project entirely.

from incremental-dom.

sparhami avatar sparhami commented on May 7, 2024

After looking at the high mutation case, it seems like solving that problem also helps solving the initial creation case (since that is really just a diff with everything as a mutation). It doesn't seem like having this in the core library is really desirable.

from incremental-dom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.