The selectorForAllWidgets function now returns the old scanning
authorMike Taylor <mike@indexdata.com>
Thu, 8 May 2014 14:49:38 +0000 (15:49 +0100)
committerMike Taylor <mike@indexdata.com>
Thu, 8 May 2014 14:49:38 +0000 (15:49 +0100)
selector if the "scan_all_nodes" configuration element is set, but
otherwise the new class-based selector that Jason prefers.

src/mkws-core.js

index 8abdeda..79e95e9 100644 (file)
@@ -428,9 +428,21 @@ mkws.pagerNext = function(tname) {
 
 
   function selectorForAllWidgets() {
-    return '[class^="mkws"],[class*=" mkws"]';
+    if (mkws.config.scan_all_nodes) {
+      log("scanning selector");
+      return '[class^="mkws"],[class*=" mkws"]';
+    } else {
+      log("class-based selector");
+      var s = "";
+      for (var type in mkws.widgetType2function) {
+       if (s) s += ',';
+       s += '.mkws' + type;
+      }
+      return s;
+    }
   }
 
+
   function makeWidgetsWithin(level, node) {
     node.find(selectorForAllWidgets()).each(function() {
       handleNodeWithTeam(this, function(tname, type) {