aumcode / nfx

C# Server UNISTACK framework [MOVED]
https://github.com/agnicore/nfx
Other
391 stars 93 forks source link

JS Compiler: current element pointer #50

Closed vlapchenko closed 7 years ago

vlapchenko commented 7 years ago

Please, add to JS Compiler source laconf code an ability to get a pointer to current DOM element.

itadapter commented 7 years ago

Provide details/example

vlapchenko commented 7 years ago

Example:

/***
table {
  "?buildRow(cur_element, value11, value12);"
  "?buildRow(cur_element, value21, value22);"
  "?buildRow(cur_element, value31, value32);"
  ...
}
***/

function buildRow(root, val1, val2) {
  /***
  tr {
    td=?val1 {}
    td=?val2 {}
  }
  ***/
}
OlegPanagushin commented 7 years ago

Now you can use "?this" as pointer on current html element. Also you can create pointer on any item in tree and use it:

div{
  ljsid=root
  div="some text" {}
  "? if(root.hasChild())" {
     ....
   }
}