Explorar o código

make `getWidgetElement()` always return single elem

wangweimin %!s(int64=3) %!d(string=hai) anos
pai
achega
364059ae8a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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') || '';