tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Kuhnert (JIRA)" <tapestry-...@jakarta.apache.org>
Subject [jira] Commented: (TAPESTRY-742) LinkSubmit renders overly verbose JavaScript
Date Wed, 09 Nov 2005 04:42:28 GMT
    [ http://issues.apache.org/jira/browse/TAPESTRY-742?page=comments#action_12357100 ] 

Jesse Kuhnert commented on TAPESTRY-742:
----------------------------------------

+1 On this...I've been started to get away from defining actual functionality in .script files
and more just using them as parameter passing templates...It's much more efficient in almost
all scenerios. 

> LinkSubmit renders overly verbose JavaScript
> --------------------------------------------
>
>          Key: TAPESTRY-742
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-742
>      Project: Tapestry
>         Type: Improvement
>   Components: Framework
>     Versions: 4.0
>     Reporter: Chris Conrad

>
> The LinkSubmit component currently renders a JavaScript function for every LinkSubmit
on the page.  This is problematic for me because I have a page which could have over 100 LinkSubmits
on it (3 LinkSubmits per item with up to 50 items per page).  The current JavaScript function
which is rendered looks like:
> function onclick_LinkSubmit_0()
> {
>   var form = Tapestry.find('Form');
>   
>   if (form.events.onsubmit_handler())
>   {
>     Tapestry.find('LinkSubmit_0').value = "T";
>     form.onsubmit = null;
>     form.submit();
>   }
> }
> The LinkSubmit component could, however, add a static JavaScript file which contains
a single function which looks like:
> function onclick_LinkSubmit(form, link)
> {
>   var form = Tapestry.find(form);
>   
>   if (form.events.onsubmit_handler())
>   {
>     Tapestry.find(link).value = "T";
>     form.onsubmit = null;
>     form.submit();
>   }
> }
> The values of 'form' and 'link' can be determined at script processing time and the function
can be executed by creating a URL which look like:
> <a href="javascript:onclick_LinkSubmit('Form', 'LinkSubmit_0');">Do Something</a>
> This will substantially reduce the amount of JavaScript sent to the browser on a page
which includes many LinkSubmits.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message