thymeleaf / thymeleaf-extras-conditionalcomments

Thymeleaf "extras" dialect for correctly processing IE conditional comments (for Thymeleaf 2.x)
https://www.thymeleaf.org
Apache License 2.0
20 stars 6 forks source link

Responsive images & IE9 #4

Open yvanavermaet opened 9 years ago

yvanavermaet commented 9 years ago

Hi all

I've raised an issue about "Responsive images & IE9" on the general Thymeleaf forum and they told me to raise this issue here as it's related to this module: http://forum.thymeleaf.org/Responsive-images-amp-IE9-td4028863.html

The problem in short (more details in the link above):

I don't want to use Thymeleaf's "Legacy HTML5", if that's even a solution.

Kind regards, Yannick

danielfernandez commented 9 years ago

Thymeleaf 2.1 uses XML parsers underneath, which don't allow you to have non-closed tags. This will change in 3.0. In the meantime, you could refactor your code as:

<picture>
    <!--[if IE 9]>
        <video style="display: none;">
            <source media="(min-width: 630px)" srcset="image-352x370.jpg 1x, image-704x740.jpg 2x" />
        </video>
    <![endif]-->
    <!--[if !(IE 9)]>
            <source media="(min-width: 630px)" srcset="image-352x370.jpg 1x, image-704x740.jpg 2x" />
    <![endif]-->
    <img src="image-mobile.jpg" alt="" srcset="image-mobile@2x.jpg 2x" />
</picture>
yvanavermaet commented 9 years ago

Thanks for your reply, Daniel. We'll give your solution a go and see if the picturefill (js polyfill for browsers that don't support the picture element) still works.