Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Invalid
-
5.2
-
None
Description
When creating a new page with a huge number of zones we are initializing all them in javascript calling Tapestry.ZoneManager.initialize. This is not affecting modern browser, but for some old browser like internet explorer 6 or 7, this method can take a long time to be executed.
In order to prevent this overhead in the javascript load in the user browser, we can lazily create the zoneManager object when it is needed. For doing this we should only create the js zone object when there is some special parameter for creating it. The only time we need to create the zone in load time, is when we have some special setup for creating the zone.
The zone can be created when calling findZoneManagerForZone. If it fails to find the zone, we can try to create it, and only if it fails we will fire the error message.
Once the zone has been lazily created, findZoneManagerForZone it will find the zone following the normal behaviour.
-
-
- Eclipse Workspace Patch 1.0
#P tapestry-core
Index: src/main/resources/org/apache/tapestry5/tapestry.js
===================================================================
- src/main/resources/org/apache/tapestry5/tapestry.js (revision 1129658)
+++ src/main/resources/org/apache/tapestry5/tapestry.js (working copy)
@@ -492,6 +492,9 @@
var manager = $T(element).zoneManager;
- Eclipse Workspace Patch 1.0
-
if (!manager) {
+ var mgr = new Tapestry.ZoneManager(
);
+ if (mgr)
+ return mgr;
Tapestry.error(Tapestry.Messages.noZoneManager, element);
return null;
}
@@ -1233,7 +1236,8 @@
},
zone : function(spec)
{ - new Tapestry.ZoneManager(spec); + if (spec.show || spec.parameters || (spec.update && spec.update != 'show') ) + new Tapestry.ZoneManager(spec); },
formFragment : function(spec) {