r716 - in funjs/public_html: . funjs
Author: jruchaud Date: 2014-06-20 16:16:55 +0200 (Fri, 20 Jun 2014) New Revision: 716 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/716 Log: First if implemenation Modified: funjs/public_html/funjs/TemplateEngine.js funjs/public_html/index.html Modified: funjs/public_html/funjs/TemplateEngine.js =================================================================== --- funjs/public_html/funjs/TemplateEngine.js 2014-06-20 14:04:06 UTC (rev 715) +++ funjs/public_html/funjs/TemplateEngine.js 2014-06-20 14:16:55 UTC (rev 716) @@ -52,7 +52,6 @@ this.currentCtrl = new window[datas.ctrl]; this.currentCtrl.node = element; this.currentCtrl.load(); -// element.crtl = currentCtrl; } if (datas.click && this.currentCtrl) { @@ -94,7 +93,10 @@ } if (datas.if) { - + var test = this.parseExpression(datas.if, data); + if (test == "false") { + element.parentNode.removeChild(element); + } } } }, @@ -116,6 +118,10 @@ result = ""; } + if (negation == "!") { + result = !result; + } + } else { result = negation == "!" ^ result ? self.parseValue(trueValue, data) : self.parseValue(falseValue, data); } Modified: funjs/public_html/index.html =================================================================== --- funjs/public_html/index.html 2014-06-20 14:04:06 UTC (rev 715) +++ funjs/public_html/index.html 2014-06-20 14:16:55 UTC (rev 716) @@ -20,6 +20,9 @@ <ul> <li data-loop="list" data-loop-var="v" data-loop-index="i">{{i}} {{v}}</li> </ul> + <div data-if="{{test}}">TEST</div> + <div data-if="{{!test}}">NO TEST</div> + <div></div> </div> </script>
participants (1)
-
jruchaud@users.nuiton.org