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

Pedro Ayala updated TAP5-1776:
------------------------------

    Attachment: changes.patch
    
> Optimize the access to elements in javascript while creating a 
> formEventManager
> -------------------------------------------------------------------------------
>
>                 Key: TAP5-1776
>                 URL: https://issues.apache.org/jira/browse/TAP5-1776
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Pedro Ayala
>              Labels: javascript, optimization, performance
>         Attachments: changes.patch
>
>
> When calling the function formEventManager tapestry is storing the new 
> created Tapestry.FormEventManager in the storage space, for doing this we are 
> using $T with the element id. Because the Tapestry.FormEventManager also 
> needs to access the element, we can optimize the access to it.
> This has some performance impact while using old browsers like internet 
> explorer 7 and pages with a big number of forms.
> 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
> @@ -1119,7 +1130,8 @@ T5.extendInitializers({
>       * @since 5.2.2
>       */
>      formEventManager : function(spec) {
> -        $T(spec.formId).formEventManager = new Tapestry.FormEventManager(
> +     spec.form = $(spec.formId);
> +        $T(spec.form).formEventManager = new Tapestry.FormEventManager(
>              spec);
>      },
>  
> @@ -1457,7 +1469,7 @@ Tapestry.ErrorPopup = Class.create({
>  Tapestry.FormEventManager = Class.create({
>  
>      initialize : function(spec) {
> -        this.form = $(spec.formId);
> +        this.form = spec.form;
>          this.validateOnBlur = spec.validate.blur;
>          this.validateOnSubmit = spec.validate.submit;
>  

--
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