Fix #6913 - add more documentation to code
[roojs1] / Roo / util / CSS.js
index a227ae8..18e4fe5 100644 (file)
@@ -13,7 +13,8 @@
 /**
  * @class Roo.util.CSS
  * Utility class for manipulating CSS rules
- * @singleton
+ * @static
+
  */
 Roo.util.CSS = function(){
        var rules = null;
@@ -33,12 +34,12 @@ Roo.util.CSS = function(){
     createStyleSheet : function(cssText, id){
         var ss;
         var head = doc.getElementsByTagName("head")[0];
-        var rules = doc.createElement("style");
-        rules.setAttribute("type", "text/css");
+        var nrules = doc.createElement("style");
+        nrules.setAttribute("type", "text/css");
         if(id){
-            rules.setAttribute("id", id);
+            nrules.setAttribute("id", id);
         }
-        if (!typeof(cssText) == 'string') {
+        if (typeof(cssText) != 'string') {
             // support object maps..
             // not sure if this a good idea.. 
             // perhaps it should be merged with the general css handling
@@ -53,22 +54,22 @@ Roo.util.CSS = function(){
                 
             }
             cssText = cssTextNew.join("\n");
-            console.log(cssText);
+            
         }
        
        
        if(Roo.isIE){
-           head.appendChild(rules);
-           ss = rules.styleSheet;
+           head.appendChild(nrules);
+           ss = nrules.styleSheet;
            ss.cssText = cssText;
        }else{
            try{
-                rules.appendChild(doc.createTextNode(cssText));
+                nrules.appendChild(doc.createTextNode(cssText));
            }catch(e){
-               rules.cssText = cssText; 
+               nrules.cssText = cssText; 
            }
-           head.appendChild(rules);
-           ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
+           head.appendChild(nrules);
+           ss = nrules.styleSheet ? nrules.styleSheet : (nrules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
        }
        this.cacheStyleSheet(ss);
        return ss;
@@ -109,12 +110,12 @@ Roo.util.CSS = function(){
    },
 
    // private
-   cacheStyleSheet : function(ss){
+   cacheStyleSheet : function(stylesheet){
        if(!rules){
            rules = {};
        }
        try{// try catch for cross domain access issue
-           var ssRules = ss.cssRules || ss.rules;
+           var ssRules = stylesheet.cssRules || stylesheet.rules;
            for(var j = ssRules.length-1; j >= 0; --j){
                rules[ssRules[j].selectorText] = ssRules[j];
            }