incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: Trinidad: How does PPR replace content in the dom?
Date Fri, 08 Dec 2006 04:01:13 GMT
On 12/7/06, Böhringer Jochen <Jochen.Boehringer@tcc-products.de> wrote:
> Hello,
>
> how does PPR replace content in the dom of the page. I know that PPR uses an IFrame.
But how is the data loaded into the IFrame copied into the main page?
>
> I guess it could be realized this way:
>
> 1.) Load new HTML markup into the IFrame.
> 2.) Copy the new markup in the Iframe to the main Frame using .innerHtml

Roughly speaking, yes, though it's a lot more complicated than that.

>
> Am I right or is it done using another mechanism? If I'm right and I have a component
whose renderer generates markup containing <script>alert('Test');</script>
>
> This scriptlet would first be executed after loaded into the iframe. And would be executed
a second time if the ppr mechanism has copied it into the main frame. Is this correct?

No, it's actually more clever than that - as long as you write out the
script element using ResponseWriter.startElement.  My memory's gotten
a little fuzy on the details - you may
also need to call writeAttribute("defer", Boolean.TRUE, null).  But,
at any rate, the script
is blocked for execution in the iframe, then executed in the main page.

When I get the chance to rewrite the code to use XMLHttp instead of an iframe,
this gets a bit easier in some ways (a bit harder in others).

-- Adam


> If yes, how can I generate a javascript in a renderer which is called after the markup
is copied into the mainframe and not in the iframe? Is there a special trick I can use in
a component using PPR capabilities? I would like to do it the Trinidad way, because I would
like to donate my DragAndDrop component (as soon as it works) back to Trinidad.
>
> Regards
> Jochen
>

Mime
View raw message