<footer>
), the class of the element (ex., .my-class
) the id of the element (ex., #the-id
), etc.li
elements would never receive the item
CSS class. By specifying a precondition such as $('.item').length
, you could ensure that the screenshot would not be taken until there were HTML elements with the class item
in the page (note that length
is an appropriate truthy value, because 0 is falsey in JavaScript).