dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.5k forks source link

Magnific Popup does not ignore leading comments in HTML #1200

Open kylesnowschwartz opened 9 months ago

kylesnowschwartz commented 9 months ago

Reproduction:

In my Ruby on Rails application, enable config.action_view.annotate_rendered_view_with_filenames which adds leading comments to the document. This shows the file path of the view partial rendered as a leading comment in the html.

When using Magnific popup with this enabled, it considers the target of the html being clicked to be the leading comment (which is the closest node) rather than the actual HTML element being clicked on.

This in turn makes the _checkIfClose() return true, because the target is not equal to the first item in mfp.content[0]

Desired:

MP ignores html comments and does not consider them a part of the content.