Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2507

Some portlets deployed to Liferay 5.2.3 cause JavaScript errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 7.0.3
    • Fix Version/s: 7.0.4
    • Component/s: ZK Client Engine
    • Security Level: Jimmy
    • Labels:
    • Environment:

      Liferay 5.2.3 bundled with Tomcat 6.0.18

      Description

      Steps to reproduce:

      1. Download and unzip the attached maven project
      2. Run mvn clean package to generate a war file
      3. Deploy the war to a Liferay 5.2.3 portal server
      4. Add the following portlet to a test page, and perform the action in parentheses

      • zkTabbox (expand the hidden tab)
      • zkGroupbox (collapse the groupbox)
      • zkCombobox (open the dropdown popup)
      • zkBandbox (open the dropdown popup)

      5. Check the console for js error

      -> Uncaught TypeError: Cannot read property 'transition' of undefined
      -> Uncaught TypeError: Cannot read property 'fx' of undefined

      Workaround:

      zk.afterLoad('zk', function() {
          var _zjq = {};
          zk.override(zjq.prototype, _zjq, {
              getAnimationSpeed : function (defaultValue) {
                  var animationSpeed = jq(this.$().$n()).data('animationspeed'),
                      jqSpeed = jq.fx.speeds;    // use jq instead of $
      		
                  if(typeof animationSpeed === 'string') {
                      if(jqSpeed[animationSpeed])
                          return jqSpeed[animationSpeed];
                      else
                          animationSpeed = parseInt(animationSpeed);
                  }
      
                  // Here are four animation functions in this class, which can't use 0 as duration so we increase animationSpeed by 1
                  return typeof animationSpeed === 'number' && !isNaN(animationSpeed) ? animationSpeed + 1 : (defaultValue || jqSpeed._default);
              },
          })
      });
      

      6. Add zkBorderlayout portlet to the test page, and refresh
      7. Check the console for js error

      • Uncaught TypeError: Cannot read property 'transition' of undefined
      • Uncaught TypeError: undefined is not a function
      Debug Tip

      i. Set a breakpoint where the first js error occurred, and refresh page

              if (... && type $.support[key] ...) { // key = 'transition'
          

      ii. After the execution is paused, enter '$ = jq;' at console, and continue
      iii. After several continuation, another js error would occur

      TypeError: Cannot read property 'propertyMap' of undefined.

      iv. Set another breakpoint where the js error occurred, and refresh page
      v. After the execution is paused, enter '$.transit = { propertyMap: {}};' at console, and continue
      vi. After several continuation, the zkBorderlayout portlet should load successfully
      vii. However, collapsing the north/south layout region will cause 'fx' js error in Step 5
      viii. Applying the workaround will make everything working again.

        Attachments

          Activity

            People

            Assignee:
            hanhsu hanhsu
            Reporter:
            neillee neillee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: