patrick-steele-idem / morphdom

Fast and lightweight DOM diffing/patching (no virtual DOM needed)
MIT License
3.21k stars 129 forks source link

element with textnode flashes when nothing has changed #106

Closed Cordemans closed 7 years ago

Cordemans commented 7 years ago

I noticed a lot of flashes in the element inspector for elements that did not actually changed. When I removed the text inside those elements, they did not flash anymore.

In this example you will notice - at least with Firefox and the element inspector open - that the element with text keeps flashing and the other element without any text does not flash: https://jsfiddle.net/ufc3wazq/2/

Should the nodeValue for a TEXT_NODE only be updated when its value actually changed?

bendulum commented 7 years ago

Same problem here!

AutoSponge commented 7 years ago

I only see a single flash when the example starts. Even when I add a counter to the text value that increases with each interval, all intervals are smooth except the first. I'm not sure if that's morphdom or jsfiddle resetting the results canvas.

patrick-steele-idem commented 7 years ago

I put some checks to only set the nodeValue on the text nodes if the old value doesn't match the new value. Please let me know if that helped, but like @AutoSponge, I am not convinced there was a problem with morphdom.

Which browser were you seeing the flashing in? Do you still see the flashing with morphdom@2.3.3?

Cordemans commented 7 years ago

Thanks! I can confirm that the flashing does not occur in morphdom@2.3.3

See image for an example what I see in Firefox 54 with morphdom@2.3.2:

morphdom 106