Comments (2)
Very well @trystian1 - as far as options, what would be interesting to be passed here? would it be like custom getVNodeKey functions?
from marionette-vdom.
Hmm since attachElContent is called from Marionette it is not possible to add options.
I'll quickly explain the problem I ran into.
At our project we use dust template helpers to define our templates. So we add/remove things from the DOM on basis of properties in the backbone model. And there where I ran into problems with the virtual DOM. Since the virtual DOM compares the old DOM state to the new DOM state. If you remove an element from the DOM it compares it to the wrong element, and removes the wrong element. Since the function to compare the old DOM to the new DOM compares on the order in the DOM. With adding keys you create the correct order, so it doesn't compare the wrong elements. I know this is really a vague issue, and it took me 2 days to find out what was happening. You can find the ordering and the comparing is done in this file:
https://github.com/Matt-Esch/virtual-dom/blob/master/vtree/diff.js
You can also see the support of adding keys in this library:
https://github.com/TimBeyer/html-to-vdom
TLDR: If you add keys, the comparing of old vs new DOM is a little bit more reliable.
from marionette-vdom.
Related Issues (8)
- Performance is really bad so far HOT 2
- In-browser version HOT 10
- Support for LayoutViews HOT 9
- YAVDOM HOT 9
- Bloated size? HOT 3
- Is this module still recommended? HOT 3
- still alive and production ready? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marionette-vdom.