I've got picture gallery on my website that contains few hundreds of images. These are miniatures that are enlarged when have been clicked. The images are well optimized (they are compressed using one of online tools and also a webp version is included). All the images have got alt description that contains keywords relevant to my site, and also file names contain the keywords (the images present some products that are named in alts and filenames).
Are keywords in alternate texts and filenames of greater importance than the size of the DOM? I know that only Google can know it, but maybe someone has had same situation and is able to share her/his experiences.
And I've got another doubt. As can be read in https://support.google.com/webmasters/answer/35769?hl=en#quality_guidelines google bot can read inside js files. But what if I would like to gernerate html code in js using for statement and a table with file names. That would produce much shorter code to be loaded, but would google bot understand all content (i.e. alts produced by conversion of filenames)?
Another doubt: I could load this js script asynchronously, because it will not be required until someone takes the action to fire the trigger. It would be very good for loading performance, but wouldn't that make it difficult for google bot to look inside it?