<p bind:class="p">Hello world!</p>
<p bind:class="a">Goodbuy world!</p>
<p class="v">Hello programmer!</p>
const elements = document.querySelectorAll('p');
const attrNamePrefix = 'bind:';
const result = Array.prototype.filter.call(
elements,
n => Array.prototype.some.call(
n.attributes,
m => m.name.startsWith(attrNamePrefix)
)
);
const result = [];
for (const n of elements) {
for (const m of n.attributes) {
if (m.name.indexOf(attrNamePrefix) === 0) {
result.push(n);
break;
}
}
}