I've recently been working on some legacy web app code that uses JAIL (https://github.com/sebarmeli/JAIL). Is it safe/sane to use JAIL on every "img" tag rather than having an additional class/id to limit the scope of JAIL to specific images?
For instance, is it advisable to do this (what our current code does):
$('img').jail();
And then expect JAIL to only kick in on images that actually have a "data-src" attribute? (90% of our images do not have data-src, and our expectation is that only data-src images will be handled by JAIL. Which seems to work most of the time, but there are a few errors that may be related to this after upgrading JAIL to 1.0.0, and it also seems like the overhead is a little crazy -- JAIL has to inspect every image?).
Should we instead using something like the img.lazy approach that the docs and examples seem to advocate (I say seem because they show this, but don't specifically recommend against the other)?
<script>
$(function() {
$('img.lazy').jail();
});
</script>
I'm not yet sure if the errors I'm seeing after upgrading are related to JAIL itself or other stuff on our site (there is a lot going on, much of it dynamic, and I'm not a JavaScript guru, so it's non-trivial to debug at the moment). (I'm seeing errors like those that were reported on earlier versions of JAIL, hence trying to upgrade from 0.9.5 to 1.0.0: https://github.com/sebarmeli/JAIL/issues/22 .)
Also, I'm concerned that even if our issues are not related to our current JAIL setup (something else), it may still be slow/expensive because we're asking JAIL to inspect every image?
Any (reasonable ;)) advice is greatly appreciated.