diff --git a/src/html_presets_processor.py b/src/html_presets_processor.py
index 30f7906..eeba3ca 100644
--- a/src/html_presets_processor.py
+++ b/src/html_presets_processor.py
@@ -28,6 +28,7 @@ class HtmlPresetsProcessor:
@staticmethod
def _decompose_tag(**kwargs):
+ kwargs["tag"].parent.attrs.update(kwargs["tag"].attrs)
kwargs["tag"].decompose()
@staticmethod
@@ -112,6 +113,7 @@ class HtmlPresetsProcessor:
@staticmethod
def _unwrap_tag(**kwargs):
+ kwargs["tag"].parent.attrs.update(kwargs["tag"].attrs)
kwargs["tag"].unwrap()
@staticmethod
@@ -153,7 +155,6 @@ class HtmlPresetsProcessor:
for parent_tag in body_tag.select(condition_on_tag[1]):
for tag in parent_tag.find_all([re.compile(tag) for tag in tags]):
# parent_tag != tag.parent
- tag.parent.attrs.update(tag.attrs)
action(body_tag=body_tag, tag=tag, rule=rule)
elif condition_on_tag[0] == "child_tags":
for tag in body_tag.find_all([re.compile(tag) for tag in tags]):