Taking display attribute of parent elements in count