[Mapbender-commits] r1912 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Dec 12 09:32:16 EST 2007
Author: verenadiewald
Date: 2007-12-12 09:32:15 -0500 (Wed, 12 Dec 2007)
New Revision: 1912
Modified:
trunk/mapbender/http/javascripts/style.js
Log:
changed way of adding styles for IE
Modified: trunk/mapbender/http/javascripts/style.js
===================================================================
--- trunk/mapbender/http/javascripts/style.js 2007-12-11 13:45:15 UTC (rev 1911)
+++ trunk/mapbender/http/javascripts/style.js 2007-12-12 14:32:15 UTC (rev 1912)
@@ -12,29 +12,34 @@
// TODO: Internet Explorer routine seems a little buggy
if (top.ie) {
// create a Style Sheet object (IE only)
- styleSheetObj=document.createStyleSheet();
+ //styleSheetObj=document.createStyleSheet();
+ // get the DOM node of the style sheet object, set the type
+ //styleObj=styleSheetObj.owningElement || styleSheetObj.ownerNode;
+ //styleObj.setAttribute("type","text/css");
- // get the DOM node of the style sheet object, set the type
- styleObj=styleSheetObj.owningElement || styleSheetObj.ownerNode;
- styleObj.setAttribute("type","text/css");
+ // alternative way for IE: take existing styleSheet with index 0 instead of creating a new one
+ styleSheetObj=document.styleSheets[0];
}
else {
// create the style node, set the style
styleObj=document.createElement("style");
styleObj.setAttribute("type","text/css");
-
+ // append the node to the head
+ document.getElementsByTagName("head")[0].appendChild(styleObj);
}
- // append the node to the head
- document.getElementsByTagName("head")[0].appendChild(styleObj);
};
/**
* Adds a class className with the CSS in cssString
*/
- this.addClass = function(className, cssString) {
+ this.addClass = function(className,cssString) {
// TODO: Internet Explorer routine seems a little buggy
if (top.ie) {
- styleSheetObj.addRule(className,cssString);
+ //add new style declaration to chosen styleSheet
+ var cssRules = cssString.split(";");
+ for (i=0; i<cssRules.length-1; i++){
+ styleSheetObj.addRule("."+className,cssRules[i]);
+ }
}
else {
// insert the content via createTextNode
More information about the Mapbender_commits
mailing list