Rewrite and refactor getVisibleElements() to make it more generic - address comments by @brendandahl
Merge pull request #2916 from Snuffleupagus/getVisibleElements

Rewrite and refactor getVisibleElements() to make it more generic