Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
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.