Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1776

Optimize the access to elements in javascript while creating a formEventManager

    XMLWordPrintableJSON

Details

    Description

      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;

      Attachments

        1. changes.patch
          0.9 kB
          Pedro Ayala

        Activity

          People

            Unassigned Unassigned
            pjayala Pedro Ayala
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: