element.py 582 B

12345678910111213141516171819202122
  1. """Base class definition for raw HTML elements."""
  2. from typing import ClassVar
  3. from reflex.components.component import Component
  4. class Element(Component):
  5. """The base class for all raw HTML elements."""
  6. _is_tag_in_global_scope: ClassVar[bool] = True
  7. def __eq__(self, other: object):
  8. """Two elements are equal if they have the same tag.
  9. Args:
  10. other: The other element.
  11. Returns:
  12. True if the elements have the same tag, False otherwise.
  13. """
  14. return isinstance(other, Element) and self.tag == other.tag