scalatags

Can scalatags be used together with binding.scala?

纵饮孤独 提交于 2020-01-13 11:04:51
问题 Binding.scala's examples contain Scala XML tags as a language to code DOM fragments. Can scalatags be used instead? 回答1: Binding.scala internally generates very sophisticated ScalaTags code. On the other hand, manually written naive ScalaTags code recreates entire DOM whenever the data changes. Milad Khajavi created an example demonstrating the problem of the manually written ScalaTags code: https://gitter.im/ThoughtWorksInc/Binding.scala?at=581b6367eed0c3125f30d57b ScalaTags is very

Can scalatags be used together with binding.scala?

萝らか妹 提交于 2020-01-13 11:03:13
问题 Binding.scala's examples contain Scala XML tags as a language to code DOM fragments. Can scalatags be used instead? 回答1: Binding.scala internally generates very sophisticated ScalaTags code. On the other hand, manually written naive ScalaTags code recreates entire DOM whenever the data changes. Milad Khajavi created an example demonstrating the problem of the manually written ScalaTags code: https://gitter.im/ThoughtWorksInc/Binding.scala?at=581b6367eed0c3125f30d57b ScalaTags is very

How to access 'this' element from event handler passed into scalatags?

耗尽温柔 提交于 2020-01-04 11:10:54
问题 I'm trying to access the text of the current ( this ) element from within an event handler created with scalatags. Here is what I tried: val onChange = {(e: HTMLElement) => number() = e.textContent.toInt }: js.ThisFunction input(`type`:="number", onchange := onChange).render When I debug the above code, nothing is being passed into the onChange function. Specifically, if I put this into the function body: js.Dynamic.global.alert(JSON.stringify(e)) , it prints {} . Also, I get an error that e