Skip to content

Html

HTMLElement

Bases: ABC

Abstract base class representing an HTML element.

This class defines the common interface for all HTML elements, providing methods for manipulating child elements.

Methods:

Name Description
appendChild

HTMLElement) -> None: Appends a child element to the current element.

removeChild

HTMLElement) -> None: Removes a child element from the current element.

Source code in zenaura/client/tags/html.py
class HTMLElement(ABC):
    """
    Abstract base class representing an HTML element.

    This class defines the common interface for all HTML elements,
    providing methods for manipulating child elements.

    Attributes:
        None

    Methods:
        appendChild(child: HTMLElement) -> None:
            Appends a child element to the current element.
        removeChild(child: HTMLElement) -> None:
            Removes a child element from the current element.
    """

    @abstractmethod
    def appendChild(self, child: "HTMLElement") -> None:
        """
        Appends a child element to the current element.

        Args:
            child: The child element to be appended.

        Raises:
            TypeError: If the provided child is not an instance of `HTMLElement`.
        """
        pass

    @abstractmethod
    def removeChild(self, child: "HTMLElement") -> None:
        """
        Removes a child element from the current element.

        Args:
            child: The child element to be removed.

        Raises:
            TypeError: If the provided child is not an instance of `HTMLElement`.
            ValueError: If the provided child is not a child of the current element.
        """
        pass

appendChild(child) abstractmethod

Appends a child element to the current element.

Parameters:

Name Type Description Default
child HTMLElement

The child element to be appended.

required

Raises:

Type Description
TypeError

If the provided child is not an instance of HTMLElement.

Source code in zenaura/client/tags/html.py
@abstractmethod
def appendChild(self, child: "HTMLElement") -> None:
    """
    Appends a child element to the current element.

    Args:
        child: The child element to be appended.

    Raises:
        TypeError: If the provided child is not an instance of `HTMLElement`.
    """
    pass

removeChild(child) abstractmethod

Removes a child element from the current element.

Parameters:

Name Type Description Default
child HTMLElement

The child element to be removed.

required

Raises:

Type Description
TypeError

If the provided child is not an instance of HTMLElement.

ValueError

If the provided child is not a child of the current element.

Source code in zenaura/client/tags/html.py
@abstractmethod
def removeChild(self, child: "HTMLElement") -> None:
    """
    Removes a child element from the current element.

    Args:
        child: The child element to be removed.

    Raises:
        TypeError: If the provided child is not an instance of `HTMLElement`.
        ValueError: If the provided child is not a child of the current element.
    """
    pass