Add a handler called with a ``DomMutation`` for each observed DOM mutation. Args: callback: Function called with a ``DomMutation``. mutation_types: Any of ``attributes``, ``childList`` and ``characterData``, as a string or an iterable of strings.
(
self, callback: Callable[[DomMutation], Any], mutation_types: str | Iterable[str] | None = None
)
| 424 | self._script.remove_javascript_error_handler(callback_id) |
| 425 | |
| 426 | def add_dom_mutation_handler( |
| 427 | self, callback: Callable[[DomMutation], Any], mutation_types: str | Iterable[str] | None = None |
| 428 | ) -> int: |
| 429 | """Add a handler called with a ``DomMutation`` for each observed DOM mutation. |
| 430 | |
| 431 | Args: |
| 432 | callback: Function called with a ``DomMutation``. |
| 433 | mutation_types: Any of ``attributes``, ``childList`` and |
| 434 | ``characterData``, as a string or an iterable of strings. |
| 435 | Defaults to ``("attributes",)``. |
| 436 | |
| 437 | Returns: |
| 438 | An id for ``remove_dom_mutation_handler()``. |
| 439 | """ |
| 440 | return self._script.add_dom_mutation_handler(callback, mutation_types) |
| 441 | |
| 442 | def remove_dom_mutation_handler(self, callback_id: int) -> None: |
| 443 | """Remove a handler added by ``add_dom_mutation_handler()``.""" |
no outgoing calls