…results in a bunch of whitespace in the .caption div when the image had no caption. It looks like some spaces and some tabs. This makes an empty caption difficult to handle in the css.
With a little conditional widget formatting, change the code in default.xml to the following, which doesn’t output the .caption div if there’s no caption: