From 71d2a82c7a795e3e2f3e3218530e7ba6fdf390bf Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Thu, 5 Sep 2024 10:04:32 +0100 Subject: [PATCH 1/2] :closes: 6948 -- Make sure tags are case insensitive --- .../LazyRenderContent/Frontend/Processor/HelperTrait.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Optimization/LazyRenderContent/Frontend/Processor/HelperTrait.php b/inc/Engine/Optimization/LazyRenderContent/Frontend/Processor/HelperTrait.php index 8a91d3d97e..38b3c26d76 100644 --- a/inc/Engine/Optimization/LazyRenderContent/Frontend/Processor/HelperTrait.php +++ b/inc/Engine/Optimization/LazyRenderContent/Frontend/Processor/HelperTrait.php @@ -31,7 +31,7 @@ protected function get_processed_tags() { * * @param array|string[] $tags Tags to be processed. */ - return wpm_apply_filters_typed( + $tags = wpm_apply_filters_typed( 'array', 'rocket_lazy_render_content_processed_tags', [ @@ -43,5 +43,10 @@ protected function get_processed_tags() { 'HEADER', ] ); + + /** + * Convert tags to upper case here before + */ + return array_map( 'strtoupper', $tags ); } } From 2eb92d29533161b7d0776e3765468fb08b6d21bf Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Thu, 5 Sep 2024 16:20:53 +0100 Subject: [PATCH 2/2] Add test --- .../Filter/lrcProcessedTagsFilter.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/Integration/inc/Engine/Optimization/LazyRenderContent/Frontend/Filter/lrcProcessedTagsFilter.php diff --git a/tests/Integration/inc/Engine/Optimization/LazyRenderContent/Frontend/Filter/lrcProcessedTagsFilter.php b/tests/Integration/inc/Engine/Optimization/LazyRenderContent/Frontend/Filter/lrcProcessedTagsFilter.php new file mode 100644 index 0000000000..a4f4842422 --- /dev/null +++ b/tests/Integration/inc/Engine/Optimization/LazyRenderContent/Frontend/Filter/lrcProcessedTagsFilter.php @@ -0,0 +1,36 @@ +getMethod( 'get_processed_tags' ); + + $method->setAccessible(true); + $result = $method->invoke( $dom ); + + $expected = [ 'DIV', 'MAIN', 'FOOTER', 'SECTION', 'ARTICLE', 'HEADER', 'H2', 'H1', 'LI' ]; + + $this->assertSame( $expected, $result ); + } +}