Indistinguishable properties and attributes
See original GitHub issueCurrently, the patch()
function treats every JSX attribute simultaneously as a property and an attribute - it initializes both, which means you have no ability to update them individually.
Blindly treating every JSX attribute as both a property and an attribute means that most updates are unnecessarily being done twice - one of them generating either a meaningless property or a meaningless DOM attribute. The DOM accumulates a lot of garbage this way.
For example, <div innerHTML={content}>
will inject literal HTML via the innerHTML
property, but will also create a useless innerHTML
attribute - or in some cases, such as <input value={value}>
, will initialize the value twice, first using the value
property, then again using setAttribute('value', ...)
.
I don’t have a lot of references, but snabbdom
for one separates properties from attributes - which seems sort of inevitable, at the VDOM level, if we want to solve this problem?
Issue Analytics
- State:
- Created 6 years ago
- Comments:22 (22 by maintainers)
Well, in that case I guess I’ll help myself with your fork and try to come up with a solution myself! 💪😄
Bingo, the tests are passing 😄
I’ve opened a PR which I think is ready for review now.