Yes but then I have to fetch the script via xhr...
which means more code on the javascript side of things!



Werner



Matthias Wessendorf schrieb:
isn't it better to do this in IE:
window.execScript(theActualScriptContent);

and in FF and other this:
window.eval(theActualScriptContent);

-Matthias

---------- Forwarded message ----------
From: Werner Punz <werner.p...@gmail.com>
Date: Fri, May 8, 2009 at 4:54 PM
Subject: Re: MyFaces 2.0 PartialResponseWriter + EVALs
To: dev@myfaces.apache.org


Werner Punz schrieb:
Hello everyone:

I checked what has been done on the Partial Response Writer for the Rendering. 
It is very basic, so I would propose following enhancement.

Since we need separate eval blocks for javascripts, we implement a 
PartialResponseWriterImpl which fetches the scripts
from components and later allows those scripts to be pushed into the eval part 
of the partial response.

There is a reason for that.

Although we have embedded javascript parsing in our javascripts I would see 
that as optional feature for badly behaving component sets.

The normal way for a component writer still is:
a) startElement("tagName", component)
b) writeAttribute...

write

c) endElement

The way Trinidad and others did it was simply to check for scripts at 
startElement and push them into a separate eval datastructure later to be 
processed (in our case after the update part of the p
PartialResponse a separate eval stage has to be added)

I would start to work on this issue if it is ok with anyone...
The entire functionality should be put into our PartialResponseWriterImpl not 
into the API, and will be hooked into

processPartial of PartialViewContextImpl

I am not sure how to deal with script src="..." on the protocol and javascript 
level.

Werner




Ok here is my idea regarding sript src="....

I would transform that on the server side to a small javascript ala
var scriptTag = document.createElement("script");
scriptTag.src="<src>"; document.body.append(scriptTag);
since the eval is executed after the rendering is done, this should be
even safe on IE6!

That also would still mean that the update CDATA block is just
javascript only without any preprocessing which then can be pushed
straight into the eval function!


Werner





Reply via email to