mikesol / purescript-deku

A PureScript web UI framework
https://purescript-deku.surge.sh/
Apache License 2.0
123 stars 12 forks source link

Use createContextualFragment instead of innerHTML for Pursx #85

Closed mikesol closed 2 weeks ago

mikesol commented 1 year ago

Description

Pursx currently fails in certain situations because of the hacky way it is attached to an ad hoc span parent. For example, if the child is an invalid child of a span (ie a tr) it won't work.

A separate but related issue (bundling it into this one) is that nesting of dyn and fixed pursx fails in certain situations. It certainly fails in these situations (as the bug was originally reported when using fixed), but it also may fail in others.

Solution

Use createContextualFragment.

Steps to fix

[] In makePursx_, use a comment as a placeholder instead of a span. [] In makePursx_, replace the comment by a dom fragment created via createContextualFragment. [] In attributeParent, make sure that parent/child relationships for nested pursx are handled correctly.

mikesol commented 2 weeks ago

Closing as there is currently a pursx-htmlparse2 branch that will use htmlparse2 to smooth over this & other rough edges in the pursx implementation.