roojs-core.js
[roojs1] / Roo / DomQuery.js
index 9169ada..f26e29e 100644 (file)
@@ -73,7 +73,7 @@ All selectors, attribute filters and pseudos below can be combined infinitely in
     <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
     <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
 </ul>
- * @singleton
+ * @static
  */
 Roo.DomQuery = function(){
     var cache = {}, simpleCache = {}, valueCache = {};
@@ -128,7 +128,11 @@ Roo.DomQuery = function(){
         }
         var r = [], ri = -1, cn;
         for(var i = 0, ci; ci = c[i]; i++){
-            if((' '+ci.className+' ').indexOf(v) != -1){
+           
+           
+            if((' '+
+               ( (ci instanceof SVGElement) ? ci.className.baseVal : ci.className)
+                +' ').indexOf(v) != -1){
                 r[++ri] = ci;
             }
         }
@@ -146,7 +150,7 @@ Roo.DomQuery = function(){
             return n.htmlFor;
         }
         if(attr == "class" || attr == "className"){
-            return n.className;
+           return (n instanceof SVGElement) ? n.className.baseVal : n.className;
         }
         return n.getAttribute(attr) || n[attr];
 
@@ -250,7 +254,7 @@ Roo.DomQuery = function(){
                 a = Roo.DomQuery.getStyle(ci, attr);
             }
             else if(attr == "class" || attr == "className"){
-                a = ci.className;
+                a = (ci instanceof SVGElement) ? ci.className.baseVal : ci.className;
             }else if(attr == "for"){
                 a = ci.htmlFor;
             }else if(attr == "href"){
@@ -414,8 +418,6 @@ Roo.DomQuery = function(){
                 lq = q;
                 var tm = q.match(tagTokenRe);
                 if(type == "select"){
-                    Roo.log('tm');
-                    Roo.log(tm);
                     if(tm){
                         if(tm[1] == "#"){
                             fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
@@ -423,13 +425,9 @@ Roo.DomQuery = function(){
                             fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
                         }
                         q = q.replace(tm[0], "");
-                        
                     }else if(q.substr(0, 1) != '@'){
                         fn[fn.length] = 'n = getNodes(n, mode, "*");';
                     }
-                    Roo.log('fn');
-                        Roo.log(fn);
-                        Roo.log(q);
                 }else{
                     if(tm){
                         if(tm[1] == "#"){
@@ -440,19 +438,11 @@ Roo.DomQuery = function(){
                         q = q.replace(tm[0], "");
                     }
                 }
-                Roo.log(modeRe);
                 while(!(mm = q.match(modeRe))){
                     var matched = false;
-                    Roo.log('mm');
-                    Roo.log(mm);
                     for(var j = 0; j < tklen; j++){
                         var t = tk[j];
                         var m = q.match(t.re);
-                        Roo.log('t');
-                        Roo.log(t);
-                        
-                        Roo.log('m');
-                        Roo.log(m);
                         if(m){
                             fn[fn.length] = t.select.replace(tplRe, function(x, i){
                                                     return m[i];