tubalmartin / riloadr

Riloadr - A cross-browser framework-independent responsive images loader written in Javascript.
MIT License
646 stars 41 forks source link

Option to avoid using mangled image tags? #25

Open mindplay-dk opened 9 years ago

mindplay-dk commented 9 years ago

Tags like <img class="responsive" ... /> are not valid - the src attribute is required for validation.

Mangled image tags also could affect search engine rankings - some engines penalize for bad markup and/or invalid links. (Technically, there's no bad link, since there's no src attribute, but since the src attribute is required, it's likely also expected, but either way - best case, it's going to be seen as faulty markup, for which you may get penalized.)

What do you think about (optionally) allowing the use of a different tag? e.g. <div> or <span> which would then get transformed to <img> when picked up by the script?

On sites where having images indexed is important, one might want to use valid <a> tags with a src attribute referencing the highest-resolution image for crawling and indexing, title attribute and/or a text-element for title/keywords. (There's a ton of possible varieties of this sort of thing, so the most simple/flexible solution might be a callback/hook of some sort.)