[ 
https://issues.apache.org/jira/browse/TAPESTRY-2390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship updated TAPESTRY-2390:
-------------------------------------------

    Fix Version/s:     (was: 5.0.13)
                   5.0

> Components or mixins requiring external javascript files and rendered via 
> AJAX do not work
> ------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2390
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2390
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript, tapestry-core
>    Affects Versions: 5.0, 5.0.11, 5.0.12
>         Environment: os x 10.4, firefox 2.0.0.13
>            Reporter: Chris Lewis
>             Fix For: 5.0
>
>         Attachments: ajax-external-js.java.patch, ajax-external-js.js.patch
>
>
> To witness the breakage, create a simple page template that includes a form 
> within a block. In this form include any component (or mixin) that requires 
> an external JS file (like datefield, palette, etc). Create a zone and tie an 
> actionlink to it. In the page class inject the block, and in the actionlink 
> handler, return the injected block. The net result is that clicking on the 
> link will fetch the form from the server via AJAX and put it in the zone.
> Now try to use the control, and you'll see it doesn't work. The problem is 
> that there is currently no infrastructure for handling external scripts added 
> via PageRenderSupport in an AJAX context. After a good bit of digging I 
> realized that the PageRenderSupport implementation (actually the 
> DocumentLinker impl) used for AJAX simply NOOPS several important methods, 
> and specifically addScriptLink().
> I see 2 ways to fix this.
> 1) Preemptively include all scripts from all components in the page, even if 
> they are not initially rendered (which is the case of a block). This may be 
> the best way to go IF that at the point of the initial page rendering T5 can 
> know every component that may ever be rendered on that page.
> 2) Extend the DocumentLinker implementation and tapestry.js to coordinate on 
> an additional key in the AJAX response. This key would hold an array of all 
> needed external JS files, and tapestry.js would handle loading them. The good 
> thing about this approach is that the JS is only ever loaded if needed.
> I'll attach patches that implement method 2, patching TapestryModule.java and 
> tapestry.js. The js extension eval()s the script code after the external 
> files have loaded. It does this using the onload handler of the dynamically 
> created script element. Granted this is a tad hackish and would need a bit 
> more testing and thought (like preventing external JS from being loaded more 
> than once), but it's a start.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to