brackets syntax

85 views
Skip to first unread message

Francesco Abbruzzese

unread,
Mar 28, 2015, 5:53:55 AM3/28/15
to knock...@googlegroups.com
What is the milestone-version  for the implementation of the bracket {...} bindings syntax in element attributes? Will the 3.4 release contain a first implementation?

Ian Yates

unread,
Mar 29, 2015, 4:15:11 PM3/29/15
to knock...@googlegroups.com
Have you seen Michael Best's Knockout Punches plugin?  http://mbest.github.io/knockout.punches/  It's great! :)

Francesco Abbruzzese

unread,
Apr 4, 2015, 10:47:20 AM4/4/15
to knock...@googlegroups.com
Yes I know about it. However, it is not a very efficient options, since it preprocess all nodes each time to transform the bracket syntax into the classic data-bind syntax each time a new node encountered during the databinding process.. This means, that in a foreach the same template is pre-processed each time it is instantiated. It would be better to pre-process the template once and forall before storing it. 

Before the implementation of components there was a discussion about the new specs, and the specs included also a more efficient implementation of the bracket syntax in knockout.js itself...but not immediately. So I am wondering when and if this will happen!

mwvan...@gmail.com

unread,
Apr 4, 2015, 11:15:12 AM4/4/15
to knock...@googlegroups.com
I sure hope that syntax will be disabled by default, or it's going to cause huge problems with just about every server-side template system I know.

Op zaterdag 28 maart 2015 10:53:55 UTC+1 schreef Francesco Abbruzzese:

Francesco Abbruzzese

unread,
Apr 4, 2015, 11:31:19 AM4/4/15
to knock...@googlegroups.com, mwvan...@gmail.com
No, if  it is efficently implemented the impact on performance should be acceptable(as compared with the dat-bond syntax pre-processing itself , since js regular expressions are fast. There might be issues only in case of big foreach. That's why templates should be pre-processed only once before storing them.

mwvan...@gmail.com

unread,
Apr 4, 2015, 11:50:09 AM4/4/15
to knock...@googlegroups.com, mwvan...@gmail.com
I'm not so much worried about performance (in particular if it's preprocessed) as I am that a lot of template engines already use brackets for their own syntax. I.e. Mustache, Smarty, Twig.
If bracket syntax is always enabled in Knockout, that'll make it more difficult to use these template engines as you'll have two template systems using (nearly) the same syntax.

Op zaterdag 4 april 2015 17:31:19 UTC+2 schreef Francesco Abbruzzese:
Reply all
Reply to author
Forward
0 new messages