Sfoglia il codice sorgente

make `getWidgetElement()` always return single elem

wangweimin 3 anni fa
parent
commit
364059ae8a
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      webiojs/src/models/output.ts

+ 3 - 0
webiojs/src/models/output.ts

@@ -280,6 +280,9 @@ export function getWidgetElement(spec: any) {
         throw Error("Unknown type in getWidgetElement() :" + spec.type);
 
     let elem = type2widget[spec.type].get_element(spec);
+    if (elem.length != 1)
+        elem = $(document.createElement('div')).append(elem);
+
     if (spec.style) {
         // add style attribute
         let old_style = elem.attr('style') || '';