aboutsummaryrefslogtreecommitdiff
path: root/mammoth/transforms.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/transforms.py')
-rw-r--r--mammoth/transforms.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mammoth/transforms.py b/mammoth/transforms.py
index 88db8a1..21bcbf6 100644
--- a/mammoth/transforms.py
+++ b/mammoth/transforms.py
@@ -22,6 +22,13 @@ def _each_element(transform_element):
return transform_element_and_children
+def get_descendants_of_type(element, element_type):
+ return list(filter(
+ lambda descendant: isinstance(descendant, element_type),
+ get_descendants(element),
+ ))
+
+
def get_descendants(element):
descendants = []