RevillWeb / img-2

Replace <img /> elements with <img-2> to automatically pre-cache images and improve page performance.
MIT License
1.89k stars 63 forks source link

Does not work with javascript disabled #3

Closed FliegendeWurst closed 6 years ago

FliegendeWurst commented 6 years ago

Edit: I'm talking about the example

hellsan631 commented 6 years ago

Its a javascript library that works on the client... That's like saying "This boat doesn't float without water"

FliegendeWurst commented 6 years ago

What if someone disables javascript?

ghost commented 6 years ago

@FliegendeWurst noscript is your friend...

inbn commented 6 years ago

I think that this is an important point to make — it’s not just a JavaScript library, it’s a custom HTML element, that without JavaScript, has none of the associated behaviours of a standard <img/> element - e.g. alt attributes.

The Readme suggests you should just use <img-2> elements in your HTML instead of <img> elements, then just let the JavaScript do its job, but doesn’t mention any kind of progressive enhancement methods (like noscript tags) for those users with JavaScript disabled. It would be nice to see this covered in the Readme.

guilhermemarconi commented 6 years ago

It's JS lib. If you have knowledge to use stuff like that, you probably know that, if JavaScript is disabled, you must use <noscript></noscript>.

We're talking about the obvious here.

NadyaNayme commented 6 years ago

And that shows the importance of providing context and submitting a proper bug report. Significantly less stupid sounding with the slightest hint of context.

Although I think it should be obvious to any developer working with a JS library on custom elements - it wouldn't hurt to add a <noscript> fallback to the examples.

RevillWeb commented 6 years ago

Thank you all for your comments. I think the README should be updated to provides some information regarding this and also suggest the noscript approach. However, I would like to tackle this problem using customized built-in elements instead of the autonomous custom elements it currently uses as this would allow img-2 to basically fallback to a standard img element as a progressive enhancement 👍