simplify special attribute checking logic
avoid special cases in the special case handling code 🙄
This commit is contained in:
parent
593a0229fa
commit
e3ecf29254
@ -169,8 +169,10 @@ class SpecialAttributes(enum.Enum):
|
|||||||
to a style prop.
|
to a style prop.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DATA = "data"
|
DATA_UNDERSCORE = "data_"
|
||||||
ARIA = "aria"
|
DATA_DASH = "data-"
|
||||||
|
ARIA_UNDERSCORE = "aria_"
|
||||||
|
ARIA_DASH = "aria-"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_special(cls, attr: str) -> bool:
|
def is_special(cls, attr: str) -> bool:
|
||||||
@ -182,7 +184,4 @@ class SpecialAttributes(enum.Enum):
|
|||||||
Returns:
|
Returns:
|
||||||
True if the attribute is special.
|
True if the attribute is special.
|
||||||
"""
|
"""
|
||||||
for value in cls:
|
return any(attr.startswith(value.value) for value in cls)
|
||||||
if attr.startswith(f"{value.value}-") or attr.startswith(f"{value.value}_"):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
Loading…
Reference in New Issue
Block a user