DrSensor / nusa

incremental runtime that bring both simplicity and power into webdev (buildless, cross-language, data-driven)
MIT License
4 stars 0 forks source link

Conditional rendering via XML transform #42

Closed DrSensor closed 1 year ago

DrSensor commented 1 year ago

Certain WG use xml transform like <xsl:if> for declarative custom element (DCE) 🤯

https://github.com/EPA-WG/custom-element

I highly recommend to check their code. However, their current implementation cause double parsing:

  1. parse HTML (before custom-element:defined)
  2. parse XML (after custom-element:defined)

The worst part is it parse the whole content inside \<custom-element>. So phase 1 is HTML->DOM then phase 2 is DOM->XML->DOM.

I didn't expect this since I try hard to avoid XML related API like XPath query.