dotvvm icon indicating copy to clipboard operation
dotvvm copied to clipboard

Move Head/BodyResourceLinks insertion to compile-time

Open exyi opened this issue 2 years ago • 0 comments

We used to insert the ResourceLink at the end of HtmlGenericControl Render, when head or body element was rendered. After this change, the component is inserted compile time into the proper head or body element. This solves the following problems

  • when body contained only literals, LiteralOptimizationVisitor would collapse them into a text: ... binding, which removed all the resources inside
  • when is accidentaly used in the page, resources are rendered on some random place
  • when no body or head tag is found, it would crash Now I'm not sure we want to support this, the error message is reasonable (suggests adding head and body elements) and this "smartness" might now cause problems in markup controls declared as views

The change contains large number of test edits for the following reason

  • new component is inserted into all trees, changing unique ids
  • BodyResourceLink and HeadResourceLinks are added to the pages, so I needed to ignore them when the control tree is being checked.

exyi avatar Feb 13 '23 14:02 exyi