Browse Source

do not crash if style can not be removed

Rodja Trappe 2 năm trước cách đây
mục cha
commit
efffeabff2
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      nicegui/element.py

+ 2 - 1
nicegui/element.py

@@ -97,7 +97,8 @@ class Element(ABC, Visibility):
         '''
         style_dict = deepcopy(self._style) if replace is None else {}
         for key in self._parse_style(remove):
-            del style_dict[key]
+            if key in style_dict:
+                del style_dict[key]
         style_dict.update(self._parse_style(add))
         style_dict.update(self._parse_style(replace))
         if self._style != style_dict: