FIX: an `<a>` with a target of _blank wants a new window (PR #9607)

…even if it wraps an image.

Currently there’s a bug preventing some links opening new windows when they need it. E.g. in case an element wraps an like this:

<a href="http://example.com/" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Acer_palmatum_sango_kaku.jpg/440px-Acer_palmatum_sango_kaku.jpg"/></a>

Actual result: In this case when user clicks the link the URL is opened in current window Expected result: the URL should be opened in new window

This improves https://github.com/discourse/discourse/commit/246997dbd918bafff7336199463a0bfe1e500bef : e.target will be an in this case not having target="_blank".

GitHub

Thanks! This is a nice fix.