These are chat archives for ThoughtWorksInc/Binding.scala

Nov 2016
杨博 (Yang Bo)
Nov 06 2016 05:45
Yes, the whole tree will be re-rendered on any data change. It doesn't matter for server-side rendering because the data source usually does not change during a request.

I think the normal scala.xml literal is available for server side rendering, when you use Binding { ??? } block instead of @dom.

Have you tried it?

Nov 06 2016 07:50

I realize it doesn't matter for server, but I want to share the same template code between a server and client.

When I use scala.xml literals inside Binding, it works with plain tags, but fails when using onclick attribute. With ScalaTags I can ignore onclick attribute on server by overriding onclick, is it possible with xml literals?

杨博 (Yang Bo)
Nov 06 2016 07:55
I guess it is possible by adding some implicit conversion from Functions to empty NodeSeqs
杨博 (Yang Bo)
Nov 06 2016 08:01
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.

scala> implicit def empty[A, B](ff: A=>B) = None
warning: there was one feature warning; re-run with -feature for details
empty: [A, B](ff: A => B)None.type

scala> <foo bar={xx:Int => xx + 1}/>
res0: scala.xml.Elem = <foo/>
Seems it works