On Mon, 13 Aug 2012 15:57:17 -0300, Alex Kotchnev <akoch...@gmail.com> wrote:

Steve - thanks a lot, this is a very clean and nice solution to this issue. Very nice !

Very nice indeed. :) It's quite nice to see how simple the solutions people find when using Tapestry. By the way, I have one suggestion: return false in beginRender to avoid content put inside the component body to be rendered.


Cheers,

Alex K

On Sun, Aug 12, 2012 at 5:34 AM, Steve Eynon <steve.ey...@alienfactory.co.uk
wrote:

I use this little component:

import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.Parameter;

public class IfIe {

    @Parameter(required=true, defaultPrefix="literal")
    private String test;

    public void beginRender(MarkupWriter writer) {
        // write out a dummy tag to prevent T5 from writing it's
script tags 'inside' the IE comment!
        writer.element("script", "type", "text/javascript");
        writer.end();

        writer.writeRaw("\n<!--[if ");
        writer.writeRaw(test);
        writer.writeRaw("]>\n");
    }

    public void afterRender(MarkupWriter writer) {
        writer.writeRaw("\n<![endif]-->\n");
    }
}

<html>
<head>
    <title>Feel The Pain</title>
    <t:ifIe test="lt IE 9">
        <script type="text/javascript"
src="${asset:context:/javascript/html5shiv-rc1.js}"></script>
    </t:ifIe>
</head>
  ...

--
Steve Eynon
-------------------------------
"If at first you don't succeed,
   so much for skydiving!"



On 19 July 2012 09:10, Alex Kotchnev <akoch...@gmail.com> wrote:
> I'll give George's suggestion a go tomorrow. It seems like I should be
able
> to do this from the layout components that pages use, so that I don't
have
> to add the code to each page.
>
> Cheers,
>
> Alex K
> On Wed, Jul 18, 2012 at 4:51 PM, trsvax <trs...@gmail.com> wrote:
>
>> For this particular case I suspect you just want this on every page in
the
>> site.
>>
>> If so the simplest way would be just include the following in your
>> layout.tml file
>>
>> &lt;!--[if lt IE 9]&gt;
>>
>>  &lt;![endif]--&gt;
>>
>> --
>> View this message in context:
>>
http://tapestry.1045711.n5.nabble.com/Conditionally-IE-including-javascript-tp5714506p5714581.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to