File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -2069,18 +2069,18 @@ def maybe_convert_css_to_tuples(style: CSSProperties) -> CSSList:
2069
2069
('border','1px solid red')]
2070
2070
"""
2071
2071
if isinstance (style , str ):
2072
- s = style .split (";" )
2073
- try :
2074
- return [
2075
- (x .split (":" )[0 ].strip (), ":" .join (x .split (":" )[1 :]).strip ())
2076
- for x in s
2077
- if ":" .join (x .split (":" )[1 :]).strip () != ""
2078
- ]
2079
- except IndexError as err :
2072
+ if ":" not in style :
2080
2073
raise ValueError (
2081
2074
"Styles supplied as string must follow CSS rule formats, "
2082
- f"for example 'attr: val;'. '{ style } ' was given."
2083
- ) from err
2075
+ + f"for example 'attr: val;'. '{ style } ' was given."
2076
+ )
2077
+ s = style .split (";" )
2078
+ return [
2079
+ (x .split (":" )[0 ].strip (), ":" .join (x .split (":" )[1 :]).strip ())
2080
+ for x in s
2081
+ if ":" .join (x .split (":" )[1 :]).strip () != ""
2082
+ ]
2083
+
2084
2084
return style
2085
2085
2086
2086
You can’t perform that action at this time.
0 commit comments