Cloudimage Responsive will smartly resize, compress and accelerate images across the World in your site for all devices. The plugin supports lazy loading technique with fancy animation on image load. Any questions or issues, please report to https://github.com/scaleflex/js-cloudimage-responsive/issues
Other
68
stars
15
forks
source link
Allow ciResponsive.process to use a custom root element #17
I think this could be enhanced by providing a second argument to process which would be a Node element. This would be a non breaking change. That way we could use this parameter to change the root from which the querySelectorAll is performed. It would only search from a sub part of the DOM rather than the whole document every time. This would prevent unnecessary work in our use case. If not provided the current behavior would remain.
What do you think? I'd be happy to open a PR for it if that's an enhancement you'll accept.
In some cases we trigger
window.ciResponsive.process()
on-demand to load images that were not present at the initial page load run. I noticed that theprocess
function processes all images of the page every time it is called: https://github.com/scaleflex/js-cloudimage-responsive/blob/1012a0b52551ffec2fa70664a4c0d8acf7dc32aa/src/plain/ci.service.js#L54I think this could be enhanced by providing a second argument to
process
which would be a Node element. This would be a non breaking change. That way we could use this parameter to change the root from which thequerySelectorAll
is performed. It would only search from a sub part of the DOM rather than the whole document every time. This would prevent unnecessary work in our use case. If not provided the current behavior would remain.What do you think? I'd be happy to open a PR for it if that's an enhancement you'll accept.
Thank you.