瀏覽代碼

correctly handle existing style

Falko Schindler 2 年之前
父節點
當前提交
56a8942dfe
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      nicegui/elements/element.py

+ 1 - 1
nicegui/elements/element.py

@@ -71,7 +71,7 @@ class Element:
         '''
         def str_to_dict(s: Optional[str]) -> Dict[str, str]:
             return dict((word.strip() for word in part.split(':')) for part in s.split(';')) if s else {}
-        style_dict = str_to_dict(self.view.style) if replace is None else {}
+        style_dict = str_to_dict((self.view.style or '').strip('; ')) if replace is None else {}
         for key in str_to_dict(remove):
             del style_dict[key]
         style_dict.update(str_to_dict(add))