我有我的元素:
<dom-module id="x-el">
<p class="special-paragraph">first paragraph</p>
<content></content>
</dom-module>
我像使用它一样
<x-el>
<p class="special-paragraph">second paragraph</p>
</x-el>
在我的命令部分:
Polymer({
is: 'x-el',
ready: function () {
/* this will select all .special-paragraph in the light DOM
e.g. 'second paragraph' */
Polymer.dom(this).querySelectorAll('.special-paragraph');
/* this will select all .special-paragraph in the local DOM
e.g. 'first paragraph' */
Polymer.dom(this.root).querySelectorAll('.special-paragraph');
/* how can I select all .special-paragraph in both light DOM and
local DOM ? */
}
});
是否可以使用内置的 Polymer 来做到这一点?或者我应该使用默认的 DOM api 吗?