[OpenLayers-Commits] r10868 - in trunk/openlayers: lib/OpenLayers lib/OpenLayers/Handler lib/OpenLayers/Layer lib/OpenLayers/Layer/WMS lib/OpenLayers/Renderer lib/OpenLayers/Tile lib/OpenLayers/Tile/Image tests tests/BaseTypes tests/Control tests/Format tests/Format/WMC tests/Layer tests/Layer/WMS tests/Marker

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Nov 2 20:10:00 EDT 2010


Author: tschaub
Date: 2010-11-02 17:10:00 -0700 (Tue, 02 Nov 2010)
New Revision: 10868

Modified:
   trunk/openlayers/lib/OpenLayers/Handler/Box.js
   trunk/openlayers/lib/OpenLayers/Lang.js
   trunk/openlayers/lib/OpenLayers/Layer/EventPane.js
   trunk/openlayers/lib/OpenLayers/Layer/Vector.js
   trunk/openlayers/lib/OpenLayers/Layer/WMS/Post.js
   trunk/openlayers/lib/OpenLayers/Popup.js
   trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
   trunk/openlayers/lib/OpenLayers/Tile/Image.js
   trunk/openlayers/lib/OpenLayers/Tile/Image/IFrame.js
   trunk/openlayers/lib/OpenLayers/Util.js
   trunk/openlayers/tests/BaseTypes/Element.html
   trunk/openlayers/tests/Control/LayerSwitcher.html
   trunk/openlayers/tests/Control/PanZoom.html
   trunk/openlayers/tests/Feature.html
   trunk/openlayers/tests/Format/GML.html
   trunk/openlayers/tests/Format/WMC.html
   trunk/openlayers/tests/Format/WMC/v1_1_0.html
   trunk/openlayers/tests/Layer/EventPane.html
   trunk/openlayers/tests/Layer/GeoRSS.html
   trunk/openlayers/tests/Layer/MapServer.html
   trunk/openlayers/tests/Layer/Text.html
   trunk/openlayers/tests/Layer/Vector.html
   trunk/openlayers/tests/Layer/WMS.html
   trunk/openlayers/tests/Layer/WMS/Post.html
   trunk/openlayers/tests/Marker/Box.html
   trunk/openlayers/tests/Popup.html
   trunk/openlayers/tests/Util.html
Log:
Avoiding unnecessary repeated checks of navigator.userAgent.  The constants added here should not be used outside the library.  In the future, they should be removed from the library. r=ahocevar (closes #2911)

Modified: trunk/openlayers/lib/OpenLayers/Handler/Box.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Box.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Handler/Box.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -206,7 +206,7 @@
                 "border-top-width")) + parseInt(OpenLayers.Element.getStyle(
                 this.zoomBox, "border-bottom-width")) + 1;
             // all browsers use the new box model, except IE in quirks mode
-            var newBoxModel = OpenLayers.Util.getBrowserName() == "msie" ?
+            var newBoxModel = OpenLayers.BROWSER_NAME == "msie" ?
                 document.compatMode != "BackCompat" : true;
             this.boxCharacteristics = {
                 xOffset: xOffset,

Modified: trunk/openlayers/lib/OpenLayers/Lang.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Lang.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Lang.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -58,7 +58,7 @@
     setCode: function(code) {
         var lang;
         if(!code) {
-            code = (OpenLayers.Util.getBrowserName() == "msie") ?
+            code = (OpenLayers.BROWSER_NAME == "msie") ?
                 navigator.userLanguage : navigator.language;
         }
         var parts = code.split('-');

Modified: trunk/openlayers/lib/OpenLayers/Layer/EventPane.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/EventPane.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Layer/EventPane.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -102,7 +102,7 @@
         this.pane.style.display = this.div.style.display;
         this.pane.style.width="100%";
         this.pane.style.height="100%";
-        if (OpenLayers.Util.getBrowserName() == "msie") {
+        if (OpenLayers.BROWSER_NAME == "msie") {
             this.pane.style.background = 
                 "url(" + OpenLayers.Util.getImagesLocation() + "blank.gif)";
         }

Modified: trunk/openlayers/lib/OpenLayers/Layer/Vector.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/Vector.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Layer/Vector.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -476,7 +476,7 @@
             // Force a reflow on gecko based browsers to prevent jump/flicker.
             // This seems to happen on only certain configurations; it was originally
             // noticed in FF 2.0 and Linux.
-            if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
+            if (OpenLayers.IS_GECKO === true) {
                 this.div.scrollLeft = this.div.scrollLeft;
             }
             

Modified: trunk/openlayers/lib/OpenLayers/Layer/WMS/Post.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WMS/Post.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Layer/WMS/Post.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -33,7 +33,7 @@
      * effects of viewport-shaking when panning the map. Both browsers, Opera
      * and Firefox/Mozilla, have no problem with long urls, which is the reason
      * for using POST instead of GET. The strings to pass to this array are
-     * the ones returned by <OpenLayers.Util.getBrowserName()>.
+     * the ones returned by <OpenLayers.BROWSER_NAME>.
      */
     unsupportedBrowsers: ["mozilla", "firefox", "opera"],
 
@@ -77,7 +77,7 @@
         OpenLayers.Layer.WMS.prototype.initialize.apply(this, newArguments);
 
         this.usePost = OpenLayers.Util.indexOf(
-            this.unsupportedBrowsers, OpenLayers.Util.getBrowserName()) == -1;
+            this.unsupportedBrowsers, OpenLayers.BROWSER_NAME) == -1;
     },
     
     /**

Modified: trunk/openlayers/lib/OpenLayers/Popup.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Popup.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Popup.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -337,7 +337,7 @@
         }
         
         //listen to movestart, moveend to disable overflow (FF bug)
-        if (!this.disableFirefoxOverflowHack && OpenLayers.Util.getBrowserName() == 'firefox') {
+        if (!this.disableFirefoxOverflowHack && OpenLayers.BROWSER_NAME == 'firefox') {
             this.map.events.register("movestart", this, function() {
                 var style = document.defaultView.getComputedStyle(
                     this.contentDiv, null
@@ -478,7 +478,7 @@
         //now if our browser is IE, we need to actually make the contents 
         // div itself bigger to take its own padding into effect. this makes 
         // me want to shoot someone, but so it goes.
-        if (OpenLayers.Util.getBrowserName() == "msie") {
+        if (OpenLayers.BROWSER_NAME == "msie") {
             this.contentSize.w += 
                 contentDivPadding.left + contentDivPadding.right;
             this.contentSize.h += 

Modified: trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/SVG.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Renderer/SVG.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -50,12 +50,6 @@
     symbolMetrics: null,
     
     /**
-     * Property: isGecko
-     * {Boolean}
-     */
-    isGecko: null,
-
-    /**
      * Property: supportUse
      * {Boolean} true if defs/use is supported - known to not work as expected
      * at least in some applewebkit/5* builds.
@@ -77,7 +71,6 @@
                                                                 arguments);
         this.translationParameters = {x: 0, y: 0};
         this.supportUse = (navigator.userAgent.toLowerCase().indexOf("applewebkit/5") == -1);
-        this.isGecko = (navigator.userAgent.toLowerCase().indexOf("gecko/") != -1);
         
         this.symbolMetrics = {};
     },
@@ -735,7 +728,7 @@
         label.setAttributeNS(null, "text-anchor",
             OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]] || "middle");
 
-        if (this.isGecko) {
+        if (OpenLayers.IS_GECKO === true) {
             label.setAttributeNS(null, "dominant-baseline",
                 OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]] || "central");
         } else {

Modified: trunk/openlayers/lib/OpenLayers/Tile/Image/IFrame.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Tile/Image/IFrame.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Tile/Image/IFrame.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -84,7 +84,7 @@
             if (this.imgDiv == null) {
                 var eventPane = document.createElement("div");
 
-                if(OpenLayers.Util.getBrowserName() == "msie") {
+                if(OpenLayers.BROWSER_NAME == "msie") {
                     // IE cannot handle events on elements without backgroundcolor.
                     // So we use this little hack to make elements transparent
                     eventPane.style.backgroundColor = '#FFFFFF';
@@ -131,7 +131,7 @@
     createIFrame: function() {
         var id = this.id+'_iFrame';
         var iframe;
-        if(OpenLayers.Util.getBrowserName() == "msie") {
+        if(OpenLayers.BROWSER_NAME == "msie") {
             // InternetExplorer does not set the name attribute of an iFrame 
             // properly via DOM manipulation, so we need to do it on our own with
             // this hack.

Modified: trunk/openlayers/lib/OpenLayers/Tile/Image.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Tile/Image.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Tile/Image.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -589,7 +589,7 @@
         // before continuing execution.
         if (OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS, 
                 this.layer.transitionEffect) != -1) {
-            if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) { 
+            if (OpenLayers.IS_GECKO === true) { 
                 this.frame.scrollLeft = this.frame.scrollLeft; 
             } 
         }
@@ -608,5 +608,5 @@
 );
 
 OpenLayers.Tile.Image.useBlankTile = ( 
-    OpenLayers.Util.getBrowserName() == "safari" || 
-    OpenLayers.Util.getBrowserName() == "opera"); 
+    OpenLayers.BROWSER_NAME == "safari" || 
+    OpenLayers.BROWSER_NAME == "opera"); 

Modified: trunk/openlayers/lib/OpenLayers/Util.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Util.js	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/lib/OpenLayers/Util.js	2010-11-03 00:10:00 UTC (rev 10868)
@@ -1540,8 +1540,45 @@
     return head;
 };
 
+/**
+ * Constant: IS_GECKO
+ * {Boolean} True if the userAgent reports the browser to use the Gecko engine
+ */
+OpenLayers.IS_GECKO = (function() {
+    return navigator.userAgent.toLowerCase().indexOf("gecko") != -1;
+})();
 
 /**
+ * Constant: BROWSER_NAME
+ * {String}
+ * A substring of the navigator.userAgent property.  Depending on the userAgent
+ *     property, this will be the empty string or one of the following:
+ *     * "opera" -- Opera
+ *     * "msie"  -- Internet Explorer
+ *     * "safari" -- Safari
+ *     * "firefox" -- FireFox
+ *     * "mozilla" -- Mozilla
+ */
+OpenLayers.BROWSER_NAME = (function() {
+    var name = "";
+    var ua = navigator.userAgent.toLowerCase();
+    if (ua.indexOf("opera") != -1) {
+        name = "opera";
+    } else if (ua.indexOf("msie") != -1) {
+        name = "msie";
+    } else if (ua.indexOf("safari") != -1) {
+        name = "safari";
+    } else if (ua.indexOf("mozilla") != -1) {
+        if (ua.indexOf("firefox") != -1) {
+            name = "firefox";
+        } else {
+            name = "mozilla";
+        }
+    }
+    return name;
+})();
+
+/**
  * Function: getBrowserName
  * 
  * Returns:
@@ -1559,29 +1596,9 @@
  *           return an empty string.
  */
 OpenLayers.Util.getBrowserName = function() {
-    var browserName = "";
-    
-    var ua = navigator.userAgent.toLowerCase();
-    if ( ua.indexOf( "opera" ) != -1 ) {
-        browserName = "opera";
-    } else if ( ua.indexOf( "msie" ) != -1 ) {
-        browserName = "msie";
-    } else if ( ua.indexOf( "safari" ) != -1 ) {
-        browserName = "safari";
-    } else if ( ua.indexOf( "mozilla" ) != -1 ) {
-        if ( ua.indexOf( "firefox" ) != -1 ) {
-            browserName = "firefox";
-        } else {
-            browserName = "mozilla";
-        }
-    }
-    
-    return browserName;
+    return OpenLayers.BROWSER_NAME;
 };
 
-
-
-    
 /**
  * Method: getRenderedDimensions
  * Renders the contentHTML offscreen to determine actual dimensions for

Modified: trunk/openlayers/tests/BaseTypes/Element.html
===================================================================
--- trunk/openlayers/tests/BaseTypes/Element.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/BaseTypes/Element.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -212,7 +212,7 @@
         style = "chickenHead";
         t.ok(OpenLayers.Element.getStyle(elem, style) == null, "get style on 'auto' style returns null");
 
-        if (OpenLayers.Util.getBrowserName() == "opera") {
+        if (OpenLayers.BROWSER_NAME == "opera") {
             elem.style.top = "15px";
             style = "top";
 

Modified: trunk/openlayers/tests/Control/LayerSwitcher.html
===================================================================
--- trunk/openlayers/tests/Control/LayerSwitcher.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Control/LayerSwitcher.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -71,7 +71,7 @@
 
     function test_Control_LayerSwitcher_redraw (t) {
 
-        t.plan( (OpenLayers.Util.getBrowserName() == "opera" ? 9 : 19 ) );
+        t.plan( (OpenLayers.BROWSER_NAME == "opera" ? 9 : 19 ) );
 
         map = new OpenLayers.Map('map');
         var layer = new OpenLayers.Layer.WMS("WMS", 
@@ -98,7 +98,7 @@
         t.eq(markersInput.value, markers.name, "wms correctly valued");
 
         t.eq(false, control.checkRedraw(), "check redraw is false");
-        if (OpenLayers.Util.getBrowserName() != "opera") { 
+        if (OpenLayers.BROWSER_NAME != "opera") { 
             control = new OpenLayers.Control.LayerSwitcher();
             var myredraw = control.redraw;
             control.redraw = function() { 

Modified: trunk/openlayers/tests/Control/PanZoom.html
===================================================================
--- trunk/openlayers/tests/Control/PanZoom.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Control/PanZoom.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -43,7 +43,7 @@
 
     function test_Control_PanZoom_control_events (t) {
 
-        if ( !window.document.createEvent || OpenLayers.Util.getBrowserName() == "opera" || !t.open_window) {
+        if ( !window.document.createEvent || OpenLayers.BROWSER_NAME == "opera" || !t.open_window) {
             //ie can't simulate mouseclicks
             t.plan(0);
             t.debug_print("FIXME: This browser does not support the PanZoom test at this time.");

Modified: trunk/openlayers/tests/Feature.html
===================================================================
--- trunk/openlayers/tests/Feature.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Feature.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -43,7 +43,7 @@
         feature = new OpenLayers.Feature(layer, lonlat, data);
         popup = feature.createPopup(); 
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq(popup.contentDiv.style[prop], "auto", 'overflow on popup is correct');
     }    
     function test_Feature_createMarker (t) {

Modified: trunk/openlayers/tests/Format/GML.html
===================================================================
--- trunk/openlayers/tests/Format/GML.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Format/GML.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -411,7 +411,7 @@
  ];
    
     var shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features xmlns:feature="http://mapserver.gis.umn.edu/mapserver" fid="221"><feature:geometry>'; 
-    if (OpenLayers.Util.getBrowserName() == "opera") {
+    if (OpenLayers.BROWSER_NAME == "opera") {
         shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features fid="221" xmlns:feature="http://mapserver.gis.umn.edu/mapserver"><feature:geometry>'; 
     }    
     var shell_end = '</feature:geometry></feature:features></gml:featureMember></wfs:FeatureCollection>';

Modified: trunk/openlayers/tests/Format/WMC/v1_1_0.html
===================================================================
--- trunk/openlayers/tests/Format/WMC/v1_1_0.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Format/WMC/v1_1_0.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -4,7 +4,7 @@
     <script type="text/javascript">
 
     function test_write_wmc_Layer(t) {
-        if (OpenLayers.Util.getBrowserName() == "safari") {
+        if (OpenLayers.BROWSER_NAME == "safari") {
             t.plan(0);
             t.debug_print("Safari has wierd behavior with getElementsByTagNameNS: the result is that we can't run these tests there. Patches welcome.");
             return;

Modified: trunk/openlayers/tests/Format/WMC.html
===================================================================
--- trunk/openlayers/tests/Format/WMC.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Format/WMC.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -130,7 +130,7 @@
          */
 
         // test v1.1.0
-        if(OpenLayers.Util.getBrowserName()== "opera") {
+        if(OpenLayers.BROWSER_NAME== "opera") {
             t.plan(0);
             t.debug_print("WMC writing works but is not tested in Opera");
         } else {

Modified: trunk/openlayers/tests/Layer/EventPane.html
===================================================================
--- trunk/openlayers/tests/Layer/EventPane.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/EventPane.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -57,7 +57,7 @@
 // MOUSEMOVE test does not seem to work... 
 //         t.plan( 2 );    
 
-        if (OpenLayers.Util.getBrowserName() != "firefox" && OpenLayers.Util.getBrowserName() != "mozilla") {
+        if (OpenLayers.BROWSER_NAME != "firefox" && OpenLayers.BROWSER_NAME != "mozilla") {
           t.plan(4);
         } else {
           t.plan(0);

Modified: trunk/openlayers/tests/Layer/GeoRSS.html
===================================================================
--- trunk/openlayers/tests/Layer/GeoRSS.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/GeoRSS.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -172,7 +172,7 @@
         });
     }
     function test_Layer_GeoRSS_loadend_Event(t) {
-        var browserCode = OpenLayers.Util.getBrowserName();
+        var browserCode = OpenLayers.BROWSER_NAME;
         if (browserCode == "msie") {
             t.plan(1);
             t.ok(true, "IE fails the GeoRSS test. This could probably be fixed by someone with enough energy to fix it.");

Modified: trunk/openlayers/tests/Layer/MapServer.html
===================================================================
--- trunk/openlayers/tests/Layer/MapServer.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/MapServer.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -226,7 +226,7 @@
                        (window.location.host == "localhost") ||
                        (window.location.host == "openlayers.org");
         
-        if (OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") {
+        if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
             t.plan(1);
             t.debug_print("Can't test google reprojection in Opera or Safari.");
         } else if(validkey) {

Modified: trunk/openlayers/tests/Layer/Text.html
===================================================================
--- trunk/openlayers/tests/Layer/Text.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/Text.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -132,7 +132,7 @@
           layer.markers[1].events.triggerEvent('click', event);
           t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
           //Safari 3 separates style overflow into overflow-x and overflow-y
-          var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+          var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
           t.eq(map.popups[0].contentDiv.style[prop],"auto", "default Popup overflow correct");
         });
     }
@@ -151,12 +151,12 @@
           layer.markers[0].events.triggerEvent('click', event);
           t.eq(map.popups.length, 1, "Popup opened correctly");
           //Safari 3 separates style overflow into overflow-x and overflow-y
-          var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+          var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
           t.eq(map.popups[0].contentDiv.style[prop],"auto", "Popup overflow read from file");
           layer.markers[1].events.triggerEvent('click', event);
           t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
           //Safari 3 separates style overflow into overflow-x and overflow-y
-          var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+          var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
           t.eq(map.popups[0].contentDiv.style[prop],"hidden", "Popup overflow read from file");
         });
     }

Modified: trunk/openlayers/tests/Layer/Vector.html
===================================================================
--- trunk/openlayers/tests/Layer/Vector.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/Vector.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -610,7 +610,7 @@
                 feature.style = customStyle5;
                 layer.drawFeature(feature);
                 t.eq(root.firstChild.getAttributeNS(null, 'style'),
-                             'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") ? "" : ';'),
+                             'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") ? "" : ';'),
                              "graphicOpacity correctly set");
                 feature.style = customStyle6;
                 layer.drawFeature(feature);

Modified: trunk/openlayers/tests/Layer/WMS/Post.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS/Post.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/WMS/Post.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -25,7 +25,7 @@
 
         layer.destroy();
 
-        var options = { unsupportedBrowsers: [OpenLayers.Util.getBrowserName()]};
+        var options = { unsupportedBrowsers: [OpenLayers.BROWSER_NAME]};
         layer = new OpenLayers.Layer.WMS.Post(name, url, params, options);
         t.eq(
             layer.usePost, false,
@@ -57,7 +57,7 @@
 
         // test the unsupported browser
         layer = new OpenLayers.Layer.WMS.Post(name, url, params, {
-            unsupportedBrowsers: [OpenLayers.Util.getBrowserName()]
+            unsupportedBrowsers: [OpenLayers.BROWSER_NAME]
         });
         map   = new OpenLayers.Map('map');
         map.addLayer(layer);

Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Layer/WMS.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -289,7 +289,7 @@
         var validkey = (window.location.protocol == "file:") ||
                        (window.location.host == "localhost") ||
                        (window.location.host == "openlayers.org");
-        if (OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") {
+        if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
             t.plan(1);
             t.debug_print("Can't test google reprojection in Opera or Safari.");
         } else if(validkey) {

Modified: trunk/openlayers/tests/Marker/Box.html
===================================================================
--- trunk/openlayers/tests/Marker/Box.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Marker/Box.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -26,7 +26,7 @@
         t.ok( box.bounds.equals(bounds), "bounds object correctly set");
         t.ok( box.div != null, "div created");
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq( box.div.style[prop], "hidden", "div style overflow hidden");
         t.ok( box.events != null, "events object created");
         t.eq( g_Color, borderColor, "setBorder called with correct border color");        

Modified: trunk/openlayers/tests/Popup.html
===================================================================
--- trunk/openlayers/tests/Popup.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Popup.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -155,7 +155,7 @@
         t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
         t.eq(contentDiv.style.position, "relative", "correct content div position");
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq(contentDiv.style[prop], "", "correct content div overflow");
         t.eq(contentDiv.innerHTML, content, "correct content div content");
 
@@ -169,7 +169,7 @@
             t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity");
         }
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(popup.div.style.borderTopWidth == s[0] && popup.div.style.borderTopStyle == s[1], "good default popup.border")
         } else {

Modified: trunk/openlayers/tests/Util.html
===================================================================
--- trunk/openlayers/tests/Util.html	2010-11-02 19:35:02 UTC (rev 10867)
+++ trunk/openlayers/tests/Util.html	2010-11-03 00:10:00 UTC (rev 10868)
@@ -97,7 +97,7 @@
 
         t.eq( div.style.position, position, "div.style.positionset correctly");    
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(div.style.borderTopWidth == s[0] && div.style.borderTopStyle == s[1], "good default popup.border")
         } else {
@@ -105,11 +105,11 @@
         }
             
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq( div.style[prop], overflow, "div.style.overflow set correctly");    
         t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");    
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq( div.style.filter, filterString, "element.style.filter set correctly");
 
         //test defaults
@@ -130,13 +130,13 @@
 
         t.eq( div.style.position, "absolute", "div.style.positionset correctly");    
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           t.ok(div.style.borderTopWidth == '' && div.style.borderTopStyle == '', "good default popup.border")
         } else {
           t.eq( div.style.border, "", "div.style.border set correctly");    
         }
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq(div.style[prop], "", "div.style.overflow set correctly");    
         t.ok( !div.style.opacity, "element.style.opacity set correctly");    
         t.ok( !div.style.filter, "element.style.filter set correctly");
@@ -168,7 +168,7 @@
         t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    
 
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
         } else {
@@ -178,7 +178,7 @@
         t.eq( image.style.position, position, "image.style.position set correctly");    
         t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");    
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq( image.style.filter, filterString, "element.style.filter set correctly");
 
         //test defaults
@@ -369,7 +369,7 @@
             filterString = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.openlayers.org/images/OpenLayers.trac.png', sizingMethod='crop') alpha(opacity=50)";
         } else {
             //Safari 3 returns null for this value, which is okay
-            var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+            var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         }        
         t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
 
@@ -385,7 +385,7 @@
         t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    
 
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
         } else {
@@ -437,7 +437,7 @@
         t.eq(parseFloat(element.style.opacity), opacity, 
              "element.style.opacity set correctly when opacity = " + opacity);
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq(element.style.filter, filterString, 
              "element.style.filter set correctly when opacity = " + opacity);
 
@@ -447,7 +447,7 @@
         t.eq(parseFloat(element.style.opacity), opacity, 
              "element.style.opacity not changed if the value is incorrect");
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq(element.style.filter, filterString, 
              "element.style.filter not changed if the value is incorrect");
 
@@ -457,7 +457,7 @@
         t.eq(parseFloat(element.style.opacity), opacity, 
              "element.style.opacity not changed if the value is incorrect");
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq(element.style.filter, filterString, 
              "element.style.filter not changed if the value is incorrect");
 
@@ -468,7 +468,7 @@
         t.eq(element.style.opacity, '', 
              "element.style.opacity is removed when opacity = " + opacity);
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : '';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : '';
         t.eq(element.style.filter, filterString, 
              "element.style.filter is removed when opacity = " + opacity);
     }
@@ -498,18 +498,18 @@
 
         t.eq( element.style.position, position, "element.style.position set correctly");    
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(element.style.borderTopWidth == s[0] && element.style.borderTopStyle == s[1], "good default popup.border")
         } else {
           t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
         }
         //Safari 3 separates style overflow into overflow-x and overflow-y
-        var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+        var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
         t.eq( element.style[prop], overflow, "element.style.overflow set correctly");    
         t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");    
         //Safari 3 returns null for this value, which is okay
-        var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+        var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
         t.eq( element.style.filter, filterString, "element.style.filter set correctly");
     }
 
@@ -553,7 +553,7 @@
             t.ok( true, "skipping element test outside of Mozilla");
         } else {
             //Safari 3 returns null for this value, which is okay
-            var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+            var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
             t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
         }
         t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
@@ -563,7 +563,7 @@
         t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");    
 
         //Safari 3 separates the border style into separate entities when reading it
-        if (OpenLayers.Util.getBrowserName() == 'safari') {
+        if (OpenLayers.BROWSER_NAME == 'safari') {
           var s = border.split(' ');
           t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
         } else {



More information about the Commits mailing list