1
聚合物中是否有替代querySelectorAll?用聚合物替代querySelectorAll
我喜欢编程做很多东西,单元素我用:
ButtonElement b2 = $["b2"];
但是,如果我想获得一些单选按钮,我不能用通常的
List<InputElement> radios = querySelectorAll("[name='func']");
radios.forEach((f) {
f.onClick.listen((e) => changeFunction(f,e));
});
应该我以不同的方式去做?
对于不支持WebComponents规格的零件,或者如果你正在使用黑幕DOM,我做这样的检查浏览器: '''(this.shadowRoot) ? this.shadowRoot.querySelectorAll('。foo'):this.querySelectorAll('。foo');''' –
不要这样做,因为你可能会选择光DOM元素。使用'Polymer.dom(this.root).querySelectorAll('。foo')' –