diff --git a/src/Event/ImageMediaQueryListener.php b/src/Event/ImageMediaQueryListener.php index 29f6b69..15a6361 100644 --- a/src/Event/ImageMediaQueryListener.php +++ b/src/Event/ImageMediaQueryListener.php @@ -80,7 +80,8 @@ public function processDocument(DocumentParsedEvent $event): void AttributeHelper::removeFromNode($lastImage, ['media']); - $paragraph->replaceWith($picture); + $paragraph->detachChildren(); + $paragraph->appendChild($picture); } } diff --git a/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 images with light and dark attributes__1.txt b/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 images with light and dark attributes__1.txt index 97598e5..194628b 100644 --- a/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 images with light and dark attributes__1.txt +++ b/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 images with light and dark attributes__1.txt @@ -1 +1 @@ -image two \ No newline at end of file +

image two

\ No newline at end of file diff --git a/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 picture elements__1.txt b/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 picture elements__1.txt index 1698032..12f0b30 100644 --- a/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 picture elements__1.txt +++ b/tests/Shorthands/__snapshots__/DarkModeTest__testImages with data set 2 picture elements__1.txt @@ -1 +1,2 @@ -image one lightimage two light \ No newline at end of file +

image one light

+

image two light

\ No newline at end of file diff --git a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with maxw attribute__1.txt b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with maxw attribute__1.txt index 9d02a03..4e67074 100644 --- a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with maxw attribute__1.txt +++ b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with maxw attribute__1.txt @@ -1 +1 @@ -default \ No newline at end of file +

default

\ No newline at end of file diff --git a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with minw attribute__1.txt b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with minw attribute__1.txt index 098bedc..6bfabf1 100644 --- a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with minw attribute__1.txt +++ b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set image with minw attribute__1.txt @@ -1 +1 @@ -default \ No newline at end of file +

default

\ No newline at end of file diff --git a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different maxw attributes__1.txt b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different maxw attributes__1.txt index 832e599..e481d98 100644 --- a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different maxw attributes__1.txt +++ b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different maxw attributes__1.txt @@ -1 +1 @@ -default \ No newline at end of file +

default

\ No newline at end of file diff --git a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different minw attributes__1.txt b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different minw attributes__1.txt index 03ac7d1..1cef0fe 100644 --- a/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different minw attributes__1.txt +++ b/tests/Shorthands/__snapshots__/WidthTest__testImages with data set multiple images with different minw attributes__1.txt @@ -1 +1 @@ -default \ No newline at end of file +

default

\ No newline at end of file diff --git a/tests/__snapshots__/MediaQueryTest__testImages with data set 2 images where one has a media query__1.txt b/tests/__snapshots__/MediaQueryTest__testImages with data set 2 images where one has a media query__1.txt index 8670e81..9b5297e 100644 --- a/tests/__snapshots__/MediaQueryTest__testImages with data set 2 images where one has a media query__1.txt +++ b/tests/__snapshots__/MediaQueryTest__testImages with data set 2 images where one has a media query__1.txt @@ -1 +1 @@ -medium \ No newline at end of file +

medium

\ No newline at end of file diff --git a/tests/__snapshots__/MediaQueryTest__testImages with data set additional attributes__1.txt b/tests/__snapshots__/MediaQueryTest__testImages with data set additional attributes__1.txt index 2802759..d3a52b4 100644 --- a/tests/__snapshots__/MediaQueryTest__testImages with data set additional attributes__1.txt +++ b/tests/__snapshots__/MediaQueryTest__testImages with data set additional attributes__1.txt @@ -1 +1 @@ -medium \ No newline at end of file +

medium

\ No newline at end of file diff --git a/tests/__snapshots__/MediaQueryTest__testImages with data set multiple images with media queries__1.txt b/tests/__snapshots__/MediaQueryTest__testImages with data set multiple images with media queries__1.txt index cee41a1..27ffd88 100644 --- a/tests/__snapshots__/MediaQueryTest__testImages with data set multiple images with media queries__1.txt +++ b/tests/__snapshots__/MediaQueryTest__testImages with data set multiple images with media queries__1.txt @@ -1 +1 @@ -The actual image and the alt that will be used \ No newline at end of file +

The actual image and the alt that will be used

\ No newline at end of file diff --git a/tests/__snapshots__/MediaQueryTest__testImages with data set single image with media query__1.txt b/tests/__snapshots__/MediaQueryTest__testImages with data set single image with media query__1.txt index 0ec9331..7db61b8 100644 --- a/tests/__snapshots__/MediaQueryTest__testImages with data set single image with media query__1.txt +++ b/tests/__snapshots__/MediaQueryTest__testImages with data set single image with media query__1.txt @@ -1 +1 @@ -large \ No newline at end of file +

large

\ No newline at end of file