reason for adding js libraries at the end of the document:

https://issues.apache.org/jira/browse/TAPESTRY-2364

you could write an own Flash component that adds the js 
libraries into the head section:

public class Flash() {

   beginRender(MarkupWriter writer) {
   Document d = writer.getDocument();
   Element head = d.find("html/head");
 
   head.element("script", ...);

   }
}

i think you get the idea

g,
kris




"kranga" <[EMAIL PROTECTED]> 
25.06.2008 14:02
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
"Tapestry users" <users@tapestry.apache.org>
Kopie

Thema
Re: T5 5.0.13 Javascript rendering at end of document - questions regd







Filip,
    That will not work because 1) the Flash player javascript is called 
in-line to render the Flash player and 2) within the flash player 
javascript, I've got some dynamic parameters being added. I can rework (2) 

to make it a function parameter and put the dynamic nature in the inline 
function call but that will still fail. Here is why:


<html>
    <body>
        HTML tags ....

        <script> renderFlashPlayer(${myParam}) </script>

        Other HTML tags ...


        <script src="flashUtil.js"/>
        <script src="flashPlayer.js"/>
    </body>
</html>

So if renderFlashPlayer lives in flashPlayer.js, it will simply not work! 
My 
only alternative is to manually include flashUtil.js in the header and 
inline flashPlayer.js. This is unnatural and against the grain. I suspect 
that there are other similar scenarios.

----- Original Message ----- 
From: "Filip S. Adamsen" <[EMAIL PROTECTED]>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Wednesday, June 25, 2008 7:51 AM
Subject: Re: T5 5.0.13 Javascript rendering at end of document - questions 

regd


> Actually, you can just put the JavaScript in a .js file and then include 

> it with @IncludeJavaScriptLibrary. Then add a call to 
> RenderSupport#addScript in your page's afterRender handler that does the 

> setup you need.
>
> For this and more, check 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/ajax.html.
>
> -Filip
>
> On 2008-06-25 13:46, kranga wrote:
>> One more addition: When including the flash player in a page, the 
>> recommended technique is to put inline javascript that renders the 
flash 
>> player where the javascript appears in the page. The javascript relies 
on 
>> an external javascript file being included. If I do an asset injection 
of 
>> the Flash javascript, it ends up at the bottom of the page and the 
flash 
>> player inline javascript fails. So it seems like one would need to 
>> override this behavior. Otherwise I'd have to package up the inline 
>> javascript as a method, inject that and then call it in place. But I'm 
>> concerned with putting all the javascript for the flash in a Java file. 

>> That is not a natural fit.
>>
>>
>>> I have some questions regarding the decision to render Javascript at 
the 
>>> end of the document:
>>>
>>> 1) What was the rationale/dirver for this?
>>> 2a) The upgrade notes say to use RenderSupport. Can anyone provide a 
>>> short description of how to use RenderSupport to inject a simple 
>>> javascript function?
>>> 2b) This implies that a lot of inline javascript will have to be moved 

>>> from .tml to .java classes. It seems this will reduce the 
"naturalness" 
>>> of being able to use javascript normally.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to