Lightbox: Ignore HTML fragments that don't exist during outside check

Fixes #6335