There is no way to patch element with id and classes without replacing it
See original GitHub issueThere is no way to patch already existing element with classes and id, if root vnode also has id or classes.
var elm = document.createElement('div');
elm.setAttribute('id', 'testid');
var vnode = h('div#testid', 'testtext');
patch(elm, vnode);
console.log(elm === vnode.elm); // false
console.log(elm.innerText); // ''
console.log(vnode.elm.innerText); // 'testtext'
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to change the element with no ID in jquery?
You can actually search for spans based on their contents if that is the only way you have of identifying them.
Read more >The Difference Between ID and Class | CSS-Tricks
There is nothing stopping you from having both an ID and a Class on a single element. In fact, it is often a...
Read more >Type, class, and ID selectors - Learn web development | MDN
A type selector is sometimes referred to as a tag name selector or element selector because it selects an HTML tag/element in your...
Read more >Selectors - W3C
A simple selector is either a type selector or universal selector followed immediately by zero or more attribute selectors, ID selectors, or pseudo-classes,...
Read more >Lesson 1: Understanding ID and Class in CSS
In this lesson you will learn how ID and Class attributes can be used to ... there's no other element - paragraph or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. The classes and id’s inside the selector are static. This has advantage that Snabbdom can use this static information exactly to determine if an element should be replaced. This makes using
key
unnecessary in many cases.Ok, thank you!