[OpenLayers-Trac] Re: [OpenLayers] #2873: Build: Compressed code "OpenLayers.js" can be reduced by 9k

OpenLayers trac-20090302 at openlayers.org
Thu Oct 14 02:44:22 EDT 2010


#2873: Build: Compressed code "OpenLayers.js" can be reduced by 9k
----------------------+-----------------------------------------------------
  Reporter:  jorix    |       Owner:  jorix       
      Type:  feature  |      Status:  reopened    
  Priority:  minor    |   Milestone:  2.11 Release
 Component:  general  |     Version:  2.10        
Resolution:           |    Keywords:              
     State:  Commit   |  
----------------------+-----------------------------------------------------

Comment(by erilem):

 Replying to [comment:22 jorix]:
 > Replying to [comment:15 erilem]:
 > > And thanks a lot jorix for bringing up the issue.
 > Thanks, I'm surprised to see much movement in one of my tickets, I am
 glad it is useful.
 >
 > Precautions to consider:
 >
 > The '''cache''' introduced in #2389 for "_getScriptLocation" '''has been
 lost'''. It is used in Map.js and in "Util.getImagesLocation"

 It's still there. The code is:

 {{{
 _getScriptLocation: (function() {
     var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
     var s = document.getElementsByTagName('script');
     var m = s[s.length-1].getAttribute("src").match(r);
     var l = m ? m[1] : "";
     return (function() { return l; });
 })()
 }}}

 The location is cached in the {{{l}}} variable. The anonymous function
 that finds the location is executed once, when the script is loaded in the
 page.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/2873#comment:24>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list