Select elements that are hidden only due to inherited style (not due to having no text content)
===

I want to select filter out the elements that are hidden due to an explicit `display: none` (on itself or an ancestor) and not because of it happens to have no text in it at the time of selection.

For example:

    <p id="p"></p>

Now, `$('#p').is(':hidden')` will be `true` because the paragraph has no text content in it and thus has no visible width or height. However, if I put some text in the p, jQuery will no longer consider it hidden (this is what my code will do with the selected elements).

Unfortunately the computed style of the element does not get overridden by `display: none` on ancestors, so it seems the only way to find out if something is hidden due to styling is to walk the tree up until an element with `display: none` is found:

    jQuery.expr.filters.reallyHidden = function(elem) {
    	do {
    		if (jQuery.css( elem, "display" ) === "none") {
    			return true;
    		}
    		elem = elem.parentNode;
    	} while (elem);
    	return false;
    };

Is there any simpler way of doing this?