소스 검색

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))