I wanted to just wrap the img tag (with a default src attribute) in a noscript tag. Then scan the noscript and rebuild the dom as necessary. But IE doesn't allow access to the DOM of noscript. So the solution isn't as elegant as I would like.
see unit/test.html and the README for examples
I want to see the README dive right into how Molt works, so I moved the "reasoning" down. I hope that makes sense to you.
molt.noscript will scan for images in noscript tags and add them to t…
the noscript tag must have the class 'molt-ir'
Move the reasoning down to the bottom of the page.
Have the README get right into what Molt is and how to use it.
highlight W dependency in the README
fix noscript for IE
Had to change the syntax since IE does not allow access to
the noscript tag contents
I agree with your changes in the README. But, maybe we shouldn't use cambelt.co generated images for unit tests since it's not always the case that we have internet.
Also, I think we should merge the noscript() method to the discover() one.
Furthermore, you need to update molt version int molt.js and README.markdown to 2.5.0. And, also, build molt to have the minified versions ;)
Not using cambelt.co is fine. This was a sketch to see if you liked the idea.
If you think noscript() is best incorporated in discover(), so be it. It will probably need to be updated – if it is called more than once there might be negative side effects.
Uh... I see what you're talking about. Maybe we should drop parsed noscript markups?
What do you think about that? ^^
Maybe, I am not sure.
I ended up taking a different route. I needed to have something like molt, but I didn't need the screen resize/refresh.
I took your concept and created a new script. It depends on jQuery, doesn't have any noscript support (it isn't needed in my case), also it loads images in a controlled manner – which is critical in my cause since there might 90 hi res images on a page. It all our loaded at once it takes longer to see the first few images.
I don't exactly understand... What is the differences between our scripts?
And why do you want to drop W features (refreshing on resize/zoom)? It could be interesting if I put W features as an option in molt, maybe.
Here is what is different:
The block of sizing code is separate from the URL. This made it bit easier to code, although using the "*" for a replacement might bite me.
I don't need the W support. I need to load image sizes based upon the device's screen size, not the window size. The last thing I want is to load new images when the screen resizes.
I need orderly loading of images. The faster the first, second, third, ... image load, the better.
My images come from different hosts. The browser will try to load more than three images at a time. This slows down the time to see the first image. So my script has stricter controls on how images load.
Finally, having a jQuery dependency is not a bad thing for my needs.
Molt is solving a slightly different problem. Making W an option might be a good idea, or not. I don't know.
Molt's charm is the html syntax. Once I saw the below, it was an ah ha moment:
Woo, 5 months...
Anyway... Not loading new images when the screen/window resizes could be a great option for molt. And especially loading images in order. I think I'll should put my hands on that thing later, when I'll work on the merge of your pull request ;)
I close that PR. Nowadays, supporting a noscript seems useless.