If you absolutely have to do it, it would be more efficient to iterate through the tree recursively, because then once you hit an element that is less than what you need, you know nothing inside of it can be the required size. Still seems like there would be a better solution under most circumstances, but I don't know your specific problem.
EDIT:
This works.
function findElements( width, height, element ){
var results = Array();
for( var i=0; i<element.childNodes.length; i+=1 ){
var childElement = element.childNodes[i];
if( childElement.clientWidth == width && childElement.clientHeight == height ){
results.push(childElement);
results = results.concat(findElements(width, height, childElement));
} else if( childElement.clientWidth < width || childElement.clientHeight < height ){
continue;
} else {
results = results.concat(findElements(width, height, childElement));
}
}
return results;
}
findElements(myWidth, myHeight, document);