How to solely upgrade an element and all its children

浪子不回头ぞ 提交于 2019-12-22 09:29:00

问题


Using componentHandler.upgradeAllRegistered(); upgrades all matching elements within the DOM, which is an unnecessary performance cost in my case:

When I insert an element in the DOM, anything from parent to root does not need to be re-upgraded. Only the element and its children are newly created elements and need re-initialization.

How can I achieve this functionality?

Some insides: https://github.com/google/material-design-lite/issues/871


回答1:


componentHandler.upgradeElements(node)

Where the node variable is the element (and children) you wish to upgrade.



来源:https://stackoverflow.com/questions/32059966/how-to-solely-upgrade-an-element-and-all-its-children

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!