cjss-group / CJSS

A CSS based web framework
https://cjss.js.org/
MIT License
670 stars 20 forks source link

Fix #27: Support (mutually) recursive rewrites #40

Closed c-harding closed 5 years ago

c-harding commented 5 years ago

This works by rerunning all previously run rules on the newly added subtree after running a rule with a body stage, ensuring that the same rule is never run on the same element twice.

c-harding commented 5 years ago

This is based upon #37, so that one needs to be merged first.

c-harding commented 5 years ago

It's worth noting that the rerun prevention checks don't work with the current implementation of body: html(…), because the elements are destroyed and recreated when yield (or whatever it's renamed to after #39) is used. I would propose either deprecating the yield parameter in html form, or finding some other solution for interpolation. For example, where yield is called, interpolate a new object with a fresh id, then substitute the existing children to that location. This will require a bit of external change though, in the case that the user tries to manipulate the yield variable as a string.