CSS selector for all elements starting with a prefix : <p>I have several polymer elements.</p>

<pre><code>&lt;ps-el-one/&gt;
&lt;ps-el-two/&gt;
&lt;ps-el-three/&gt;
&lt;ps-el-four/&gt;
</code></pre>

<p>I want to be able to query all of the elements which begin with "ps-"  with either a CSS selector or javaScript.</p>

<p>I whipped up the following solution, but I am wondering if there is anything more efficient?</p>

<pre><code>var allElementsOnPage = document.querySelectorAll('*');
var res = [];
for (var index in allElementsOnPage) {
  var el = allElementsOnPage[index];
  if (el &amp;&amp; el.tagName &amp;&amp; el.tagName.substr(0, 3) == 'PS-') {
    res.push(el);
  }
}
</code></pre>

<p>This solution seems very inefficient.</p>
