tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norbert Sándor (JIRA) <tapestry-...@jakarta.apache.org>
Subject [jira] Commented: (TAPESTRY-742) LinkSubmit renders overly verbose JavaScript
Date Wed, 09 Nov 2005 08:11:20 GMT
    [ http://issues.apache.org/jira/browse/TAPESTRY-742?page=comments#action_12357106 ] 

Norbert Sándor commented on TAPESTRY-742:
-----------------------------------------

It would be very good, I've the same problem with LinkSubmit!

BR,
Norbi

/*
Please allow a little bit nostalgia :)

Once I've created a similar extension to Tapestry. However the implementation was very QnD,
so I used it only for researching reasons but not "in action" :) There were several "open
questions" in it :)
It was created long ago, so nowadays dojo/etc mechanisms would probably deprecate it.

The main features were:
- a javascript library with basic functionality (inheritance, collections, etc.)
- *.jsobject.xml file for defining javascript classes with two parts
  - pure javascript class definition part
  - object creation part: this part created a new javascript representation of the serverside
component by passing parameters to the constructor of its class
    This part allowed the following elements:
    - ${...} is the same as in *.script
    - $[...] converted the value to a javascript type, with converters for primitive types,
strings, arrays, collections
    - $() inserted a reference to a component. This was a little bit tricky because of foreach-like
renderings in Tapestry.
      So $(next:component) referenced the next (possibly) rendered instance of the component,
while $(last:component) referenced the last one.
      These $() parts were translated to a valid clientside reference to the javascript representation
of the given component.
- the client and server side communicated using a datasqueezer-like construct (but the clientside
was able to squeeze a subset of the possible types, too, eg. primitives, collections)

It wasn't easy to implement but finally ended up in trash :)
*/

> 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