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

Parent and Cascade binding #37

Open DrSensor opened 1 year ago

DrSensor commented 1 year ago
<render-scope data-cascade>
  <link href=counter.js>

  <button :: on:click=increment>increment</button>

  <render-scope>
    <link href=counter.js>

    <button :: on:click=increment @text:="count &count"/>
  </render-scope>
</render-scope>

same as

<render-scope>
  <link href=counter.js>

  <button :: on:click=increment>increment</button>

  <render-scope data-parent>
    <link href=counter.js>

    <button :: on:click=increment @text:="count &count"/>
  </render-scope>
</render-scope>

To turn off prefix &

<render-scope>
  <link href=counter.js>

  <button :: on:click=increment>increment</button>

  <render-scope data-isolation=open>
    <link href=counter.js>

    <button :: on:click=increment @text:="count"/>
  </render-scope>
</render-scope>

It also possible to alias the parent data


Note on Granular Data Cascade only data-cascade allowed on <link>

<link href=counter.js data-cascade>