Can't we just use jQuery for this?

    $('[attr]')

?