diff --git a/src/Pass/ImgTagTransformPass.php b/src/Pass/ImgTagTransformPass.php index fe20d796..328b8ab5 100644 --- a/src/Pass/ImgTagTransformPass.php +++ b/src/Pass/ImgTagTransformPass.php @@ -75,6 +75,7 @@ function pass() $has_height_and_width = $this->setResponsiveImgHeightAndWidth($el); if (!$has_height_and_width) { $this->addActionTaken(new ActionTakenLine('img', ActionTakenType::IMG_COULD_NOT_BE_CONVERTED, $lineno, $context_string)); + $el->remove(); continue; } if ($this->isPixel($el)) { diff --git a/tests/test-data/fragment-html/img-anim-test-fragment.html.out b/tests/test-data/fragment-html/img-anim-test-fragment.html.out index 772f89d5..7f7e67f3 100644 --- a/tests/test-data/fragment-html/img-anim-test-fragment.html.out +++ b/tests/test-data/fragment-html/img-anim-test-fragment.html.out @@ -54,12 +54,7 @@ Transformations made from HTML tags to AMP custom tags AMP-HTML Validation Issues and Fixes ------------------------------------- -FAIL - - on line 14 -- The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? - [code: MANDATORY_TAG_ANCESTOR_WITH_HINT category: DISALLOWED_HTML_WITH_AMP_EQUIVALENT see: https://www.ampproject.org/docs/reference/amp-img.html] - ACTION TAKEN: img tag was removed due to validation issues. +PASS COMPONENT NAMES WITH JS PATH ------------------------------ diff --git a/tests/test-data/fragment-html/img-test-fragment.html b/tests/test-data/fragment-html/img-test-fragment.html index 69554435..91edc258 100644 --- a/tests/test-data/fragment-html/img-test-fragment.html +++ b/tests/test-data/fragment-html/img-test-fragment.html @@ -6,7 +6,7 @@ - + diff --git a/tests/test-data/fragment-html/img-test-fragment.html.out b/tests/test-data/fragment-html/img-test-fragment.html.out index 20a30bb1..2421aac5 100644 --- a/tests/test-data/fragment-html/img-test-fragment.html.out +++ b/tests/test-data/fragment-html/img-test-fragment.html.out @@ -6,8 +6,8 @@ - - + + @@ -38,7 +38,7 @@ Line 5: Line 6: Line 7: Line 8: -Line 9: +Line 9: Line 10: Line 11: Line 12: @@ -84,10 +84,6 @@ AMP-HTML Validation Issues and Fixes ------------------------------------- FAIL - on line 10 -- The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? - [code: MANDATORY_TAG_ANCESTOR_WITH_HINT category: DISALLOWED_HTML_WITH_AMP_EQUIVALENT see: https://www.ampproject.org/docs/reference/amp-img.html] - on line 13 - The implied layout 'CONTAINER' is not supported by tag 'amp-img'. [code: IMPLIED_LAYOUT_INVALID category: AMP_LAYOUT_PROBLEM see: https://www.ampproject.org/docs/reference/amp-img.html]