Toomany DOM更新 [英] Toomany DOM updates

查看:102
本文介绍了Toomany DOM更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接[

解决方案

这是预期的行为,因为



根据 Scaladoc用于 bind 方法


每次值更改时,在当前 @dom 方法中,所有代码均在之后当前的 bind 表达式将会重新评估


因此, calc.bind 调用在强制重新创建锚元素。






我创建了请求请求以更改属性,可以避免在XHTML文字之前调用 calc.bind


The link [https://ccamel.github.io/playground-binding.scala/index.html#playground-binding.scala/home] has few demos of binding.scala I have used DomListner extension in chrome to understand the dom events. I found for each interaction there are hundreds of DOM events fired. For example one click on calculator button results in 114 events.

  1. It this a performance issue ?
  2. Does binding.scala library need performance improvements ?
  3. Does the code written using binding.scala need optimization ?

解决方案

It's the expected behavior, because the DEMO that you mentioned recreated anchor elements, explicitly.

According to the Scaladoc for bind method:

Each time the value changes, in the current @dom method, all code after the current bind expression will be re-evaluated

As a result, the calc.bind call at here forces recreating the anchor element.


I created a pull request to change the class attribute instead, by avoiding the calc.bind call before XHTML literals.

这篇关于Toomany DOM更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆