diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 26dfe845d5..18e980ded7 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -355,13 +355,12 @@ OpenLayers.Map = OpenLayers.Class({ /** * APIProperty: theme - * {String} *Deprecated* Relative path to a CSS file from which to load - * theme styles. Add a CSS resource in the HTML of your map page - * instead, e.g.: - * (code) - * - * (end) + * {String} Relative path to a CSS file from which to load theme styles. + * Specify null in the map options (e.g. {theme: null}) if you + * want to get cascading style declarations - by putting links to + * stylesheets or style declarations directly in your page. */ + theme: null, /** * APIProperty: displayProjection @@ -481,6 +480,9 @@ OpenLayers.Map = OpenLayers.Class({ this.paddingForPopups = new OpenLayers.Bounds(15, 15, 15, 15); + this.theme = OpenLayers._getScriptLocation() + + 'theme/default/style.css'; + // now override default options OpenLayers.Util.extend(this, options); @@ -543,6 +545,29 @@ OpenLayers.Map = OpenLayers.Class({ this.updateSizeDestroy); } + // only append link stylesheet if the theme property is set + if(this.theme) { + // check existing links for equivalent url + var addNode = true; + var nodes = document.getElementsByTagName('link'); + for(var i=0, len=nodes.length; i