Comments (2)
For example, rather than using childNode, use firstChild and loop through via nextSibling as DOM nodes are based on a two-way linked list – not a graph/array structure.
Oh, that's cool! Had no idea 😁
Also, I did some tests recently and its far more effective to create a lightweight "vdom" object upon inspecting and calculating what exists in a real DOM node and storing this in a WeakMap based on the DOM node itself being the key
Very interesting. What do you mean by "monomorphic" - I'm not familiar with the term in this context.
I like the idea you sketch out with WeakMap, though it's a shame it's not supported widely enough yet. We'd have to pull in a polyfill and given we seem to optimize for simplicity & file size it's probably not worth it. I was wondering if it'd be possible to do the same with an LRU-cache, but given we'd store the DOM nodes longer than we need to the potential of leaking means we could end up being worse off - I'd rather not hog too much memory haha.
To be honest I think between isSameNode() caching and requestIdleCallback
in polite-element we should already be fast enough for most applications 🚀 - thanks heaps for the feedback!! ✨
from nanomorph.
COURAGE
from nanomorph.
Related Issues (20)
- SVG use does not repaint in firefox upon second update HOT 3
- Add TypeScript typings?
- Replace events.js to be more interop HOT 4
- Is this project dead? HOT 6
- Comments are un-commented HOT 4
- patching stateful DOM (input, textarea, form fields) HOT 1
- Useless statement HOT 8
- Recommended way to cache <img> elements
- Range element min + max attributes must come before value attribute
- Interview partners for research about communication in GitHub projects wanted
- [question] the list of events HOT 6
- can't set 'onchange' event in select tag HOT 5
- implement Meyers diffing algorithm HOT 31
- Input focus lost when sibling is added to parent node. HOT 1
- Clean up the test suite HOT 1
- Event Failures
- benchmark HOT 4
- questions before switching from morphdom HOT 1
- usage without require/module manager HOT 3
- Export `updateChildren()` or `childrenOnly` option HOT 3
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 nanomorph.