Image the browser user take a screen capture of page.
I would like to write a javascript function that will tell me if in that screen capture, the DOM element i am interested in appear or not (so partially covered is ok, completely covered is not ok).
For example, pretend the DOM element i am interested in is a button, i think i need to check the following thing :
- is the button visible
- is the button inside any element that is not visible
- is the button in the view port
- is the button "totally" covered by anything (overlay)
It's trivial to know if the button is visible (eg with jQuery $("#buttonId").is(':visible')
).
It's also trivial to iterate the previous function, foreach DOM element parent.
I found out many example on how to check if the DOM element is in the view port (so also this point is clear to me)
But is not clear to me how to check if the element is completely covered by other DOM element (in a faseable, so without comparing all DOM elements) nor i am sure if i have exausted the situation in which the DOM element of interest may be not shown in the screen capture that the browser user has taken.
-- Not a duplicate
This question is not focused only on occlusion problem, and also ask if there are any other strange condition that will lead a DOM element not to be rendered in the screen capture