Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5605

Store browser capabilities in local variables in wicket-event-jquery.js

    XMLWordPrintableJSON

Details

    Description

      Methods in Wicket.Browser js class (such as isIE, isKHTML, isSafari... ) perform a regular expression test in windows.navigator.userAgent variable each time they are called.

      It would improve performance if these methods stored their result in a variable for future checks.

      As described in this InMethodGrid issue (https://github.com/wicketstuff/core/issues/308#issuecomment-44816191), recursive calls to these methods in a Windows environment with Chrome version 35 are killing the CPU.

      The solution is as simple as caching the result of the regexp test the first time the method is called and return the variable value in subsequent calls.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            manusa Marc Nuri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: