I think it is looking at where on body onclick event happened and whether it happened on the popover or not.