Sorry I just looked more into it and found some new info that might help.
Here is my exact code that is written in my blade file:
<a data-lg-size="1600-1308" data-sub-html="<h4>{{ $image->title }} </h4>">
<img src="image.jpeg">
</a>
$image->title value is <IMG SRC=# onmouseover="alert('asdsad')">
When viewing the page, inspecting the element (in Chrome), choosing "Edit as HTML" this is the output:
<a data-lg-size="1600-1308" data-sub-html="<h4><IMG SRC=# onmouseover="alert('asdsad')"> </h4>">
<img src="image.jpeg">
</a>
When viewing page source (in browser), it shows this:
<a data-lg-size="1600-1308" data-sub-html="<h4><IMG SRC=# onmouseover="alert('asdsad')"> </h4>">
<img src="image.jpeg">
</a>
Probably the javascript (a gallery plugin) converts the escaped characters back to HTML when the image is clicked?? The alert box appears when hovering the "sub-html".
I get the best result when I use data-sub-html="<h4>{{ htmlspecialchars($image->title) }}
Here is the page source then and no alert box appears when viewing the page:
data-sub-html="<h4>&lt;IMG SRC=# onmouseover=&quot;alert(&#039;asdsad&#039;)&quot;&gt;</h4>"
So, why didn't {{ }} fix the issue? Seems like Laravel has a bug.