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

Pedro Ayala updated TAP5-1775:
------------------------------

    Attachment:     (was: changes.patch)
    
> Improve javascript performance while creating zone events
> ---------------------------------------------------------
>
>                 Key: TAP5-1775
>                 URL: https://issues.apache.org/jira/browse/TAP5-1775
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Pedro Ayala
>              Labels: javascript, performance
>         Attachments: changes.patch
>
>
> While creating eventLinks and actionLinks it is necessary to call 
> updateZoneOnEvent to create the observe and store the zoneId in the element 
> for future references.
> The method is also checking if the zoneId exist before storing it in the 
> element store information. While this feature is quite useful in debug mode, 
> it is also consuming some time in production mode.
> With this patch we will prevent the check while running in production mode, 
> this improve performance in older browser like internet explorer 7.
> Index: src/main/resources/org/apache/tapestry5/tapestry.js
> ===================================================================
> --- src/main/resources/org/apache/tapestry5/tapestry.js
> +++ src/main/resources/org/apache/tapestry5/tapestry.js
> @@ -1020,21 +1020,32 @@ T5.extendInitializers({
>      updateZoneOnEvent : function(eventName, element, zoneId, url) {
>          element = $(element);
>  
> -        $T(element).zoneUpdater = true;
> -
> -        var zoneElement = zoneId == '^' ? $(element).up('.t-zone')
> -            : $(zoneId);
> -
> -        if (!zoneElement) {
> -            Tapestry
> -                .error(
> -                "Could not find zone element '#{zoneId}' to update on 
> #{eventName} of element '#{elementId}'.",
> -                {
> -                    zoneId : zoneId,
> -                    eventName : eventName,
> -                    elementId : element.id
> -                });
> -            return;
> +        var Telement = $T(element);
> +        Telement.zoneUpdater = true;
> +
> +        var destZoneId = zoneId;
> +        var zoneElement = null;
> +        if (zoneId == '^') {
> +             zoneElement = element.up('.t-zone');
> +             if (zoneElement)
> +                     destZoneId = zoneElement.id;
> +        }
> +             
> +        if (Tapestry.DEBUG_ENABLED) {
> +             if (!zoneElement && zoneId != '^')
> +                     zoneElement = $(zoneId);
> +
> +             if (!zoneElement) {
> +                 Tapestry
> +                     .error(
> +                     "Could not find zone element '#{zoneId}' to update on 
> #{eventName} of element '#{elementId}'.",
> +                     {
> +                         zoneId : zoneId,
> +                         eventName : eventName,
> +                         elementId : element.id
> +                     });
> +                 return;
> +             }
>          }
>  
>          /*
> @@ -1042,7 +1053,7 @@ T5.extendInitializers({
>           * changed dynamically on the client side.
>           */
>  
> -        $T(element).zoneId = zoneElement.id;
> +        Telement.zoneId = zoneId;
>  
>          if (element.tagName == "FORM") {
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to