You can use the Element#matches
method to filter out your original list:
var elems = document.querySelectorAll(selector);
var buttons = Array.prototype.filter.call(elems, function(elem){
return elem.matches('button');
});
Note that there are various names under which you find this method, you might want to wrap a function around them. (Please check the documentation!)
Another possibility is to get the intersection of the two sets of elements returned by document.querySelectorAll
with the two selectors. There are various implementations of the intersection of two sets, feel free to use one that is to your liking. This question provides some ideas.