Widget constructor saves $(node) as the new jqnode member.
[mkws-moved-to-github.git] / src / mkws-widget.js
index 6bb9aaa..a201424 100644 (file)
@@ -10,6 +10,7 @@ function widget($, team, type, node) {
     team: team,
     type: type,
     node: node,
+    jqnode: $(node),
     config: mkws.objectInheritingFrom(team.config())
   };
 
@@ -55,6 +56,8 @@ function widget($, team, type, node) {
   if (fn) {
     fn.call(that);
     log("made " + type + " widget(node=" + node + ")");
+  } else if (type.match(/-Container-(narrow|wide)$/)) {
+    // Not really a widget: no need to log its lack of promotion
   } else {
     log("made UNPROMOTED widget(type=" + type + ", node=" + node + ")");
   }
@@ -119,10 +122,10 @@ widget.autosearch = function(widget) {
 // Utility function for all widgets that want to hide in narrow windows
 widget.hideWhenNarrow = function(widget) {
   widget.team.queue("resize-narrow").subscribe(function(n) {
-    $(widget.node).hide();
+    widget.jqnode.hide();
   });
   widget.team.queue("resize-wide").subscribe(function(n) {
-    $(widget.node).show();
+    widget.jqnode.show();
   });
 };