bikeshaving / crank

The Just JavaScript Framework
https://crank.js.org
MIT License
2.7k stars 75 forks source link

Fix static content in <Raw/> disappearing after component refresh #224

Closed waynebaylor closed 3 years ago

brainkim commented 3 years ago

So I wouldn’t mind merging this in as is, but I wonder if reparsing a <Raw /> value for every update is optimal. You can always use the new c-static prop to prevent the <Raw /> element from updating, but it seems very typical for developers to want the <Raw /> element to be left alone when the value is constant. Tracking the old and new value for changes just for this use-case seems like a hassle.

One alternative is to have renderer.parse() return Array.from(fragment.childNodes), but this would involve changing some types around I bet. I’m happy to merge as is, publish a minor release, and iterate on this in my own time, but I’m happy to hear your thoughts.

waynebaylor commented 3 years ago

Changing the return type of renderer.parse() turned out to be pretty easy. Let me know if this is going in the right direction 😄