Skip to content

Commit be25255

Browse files
committed
simplify
1 parent 3f97a8a commit be25255

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/textual/dom.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,9 +1668,10 @@ def has_pseudo_class(self, class_name: str) -> bool:
16681668
Returns:
16691669
`True` if the DOM node has the pseudo class, `False` if not.
16701670
"""
1671-
return class_name in self._PSEUDO_CLASSES and self._PSEUDO_CLASSES[class_name](
1672-
self
1673-
)
1671+
try:
1672+
return self._PSEUDO_CLASSES[class_name](self)
1673+
except KeyError:
1674+
return False
16741675

16751676
def has_pseudo_classes(self, class_names: set[str]) -> bool:
16761677
"""Check the node has all the given pseudo classes.

0 commit comments

Comments
 (0)