denis-migdal / LISS

Light, Intuitive, Simplier, and Safer Web Components.
MIT License
2 stars 0 forks source link

Sync ${} inside content #3

Open denis-migdal opened 8 months ago

denis-migdal commented 8 months ago
  1. Fetch text node having "${" with XPath.
  2. Fetch nodes having an attribute containing "${".
  3. Build an updater (set of nodes to update)
  4. On changes, call the updater
document.evaluate(
  '//text()[contains(.,'${')]',
  document,
  null,
  XPathResult.ORDERED_NODE_ITERATOR_TYPE
)
.iterateNext()
it = document.evaluate(
  '//@*[contains(., "${")]',
  document,
  null,
  XPathResult.ORDERED_NODE_ITERATOR_TYPE
)
denis-migdal commented 7 months ago
  1. Get unique path ( list of childNodes idx).
  2. deep clone(true)
  3. template string with local var.