Browse Source

correctly handle existing style

Falko Schindler 2 years ago
parent
commit
56a8942dfe
1 changed files with 1 additions and 1 deletions
  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))