Ivan Asmer преди 8 години
родител
ревизия
23b355ca78
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      static/nb.js

+ 6 - 1
static/nb.js

@@ -17,7 +17,12 @@ function nbInit(a,b){
     var root=document, $s=a;
     var root=document, $s=a;
 
 
     function searchElement(root, selector){
     function searchElement(root, selector){
-        var items = [root.getElementById(selector)]; 
+        if (root === document){
+            var items = [root.getElementById(selector)]; 
+        }
+        else {
+            items = root.querySelectorAll("#" + selector); 
+        }
         items     = items[0]     ? items :  root.querySelectorAll(selector);
         items     = items[0]     ? items :  root.querySelectorAll(selector);
         items     = items.length ? items :  root.getElementsByName(selector); 
         items     = items.length ? items :  root.getElementsByName(selector); 
         items     = items.length ? items :  root.getElementsByClassName(selector); 
         items     = items.length ? items :  root.getElementsByClassName(selector);