问题
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