diff --git a/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php b/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php index 32f80c8752..6c4b248dc8 100644 --- a/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php +++ b/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php @@ -120,8 +120,8 @@ public function __invoke( OD_Tag_Visitor_Context $context ): bool { * * @since 0.3.0 * - * @param string $embed_block_xpath XPath for the embed block FIGURE tag. For example: `/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]`. - * @return string XPath for the child DIV. For example: `/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]` + * @param string $embed_block_xpath XPath for the embed block FIGURE tag. For example: `/HTML/BODY/DIV/*[1][self::FIGURE]`. + * @return string XPath for the child DIV. For example: `/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]` */ private static function get_embed_wrapper_xpath( string $embed_block_xpath ): string { return $embed_block_xpath . '/*[1][self::DIV]'; diff --git a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html index c48b204596..cb8b50e3c2 100644 --- a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/expected.html @@ -3,58 +3,58 @@ ... @@ -83,14 +83,14 @@
-
+
-
+
@@ -98,49 +98,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php index 2525c6d236..6ea4d7f7c6 100644 --- a/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/all-embeds-inside-viewport/set-up.php @@ -12,7 +12,7 @@ $elements[] = array_merge( $element_data, array( - 'xpath' => "/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[{$i}][self::FIGURE]/*[1][self::DIV]", + 'xpath' => "/HTML/BODY/DIV/*[{$i}][self::FIGURE]/*[1][self::DIV]", ) ); } diff --git a/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html b/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html index 2a29e765e1..ba37caa5ca 100644 --- a/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html @@ -3,10 +3,10 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php index 2a6649554a..e91b7b75c3 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php index 2fb1521fe8..412e1e9a87 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport-without-resized-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, // Intentionally omitting resizedBoundingClientRect here to test behavior when data isn't supplied. diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html index e53cb21847..a416747251 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php index 1cc2c139b0..2f9f6d1f01 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html index f300335810..6c44678b80 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php index 682ccfc269..1fd211c237 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) { $elements = array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html index a0ef7685f3..d55d88ef89 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/expected.html @@ -3,15 +3,15 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php index 9f87b44a6e..0da100a0b0 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-twitter-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html index 08e66b88da..24ec36b5bf 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html @@ -3,10 +3,10 @@ ... @@ -15,8 +15,8 @@
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php index 4847aca6f3..1a536025b0 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html index a8d6b7c4c3..cf6d4a12e5 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html @@ -3,10 +3,10 @@ ... @@ -15,8 +15,8 @@
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php index 7acbe1f10a..5cb633e320 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) { $elements = array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html index d048bbfcff..7b706664c1 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html @@ -3,16 +3,16 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php index 2a6649554a..e91b7b75c3 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html index b16583acb8..400790d6ef 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/expected.html @@ -3,15 +3,15 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php index 102d5f8b15..bad024fc56 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport-with-only-mobile-url-metrics/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 100, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html index 7356a23765..d159a1ddfd 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php index 1cc2c139b0..2f9f6d1f01 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-inside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'intersectionRatio' => 1, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html index d861c63867..e207715e3f 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/expected.html @@ -3,17 +3,17 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php index c52c6729c7..71fa110a0d 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-on-mobile/set-up.php @@ -3,7 +3,7 @@ foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $viewport_width ) { $elements = array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => true, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html index 73331474b9..7badfa2ad9 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/expected.html @@ -3,13 +3,13 @@ ...
-
-
+
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php index bc19530841..c192b91d6e 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport-with-only-mobile-url-metrics/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 100, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html index a6305e08d5..58f90072c4 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/expected.html @@ -3,15 +3,15 @@ ...
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php index 9f87b44a6e..0da100a0b0 100644 --- a/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/single-youtube-embed-outside-viewport/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::FIGURE]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0, 'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ), diff --git a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html index ab7c7ea09e..999512d0a5 100644 --- a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html +++ b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/expected.html @@ -3,10 +3,10 @@ ... - +
-
+
diff --git a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php index 60d662e15e..bf8f66d630 100644 --- a/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php +++ b/plugins/embed-optimizer/tests/test-cases/too-many-bookmarks/set-up.php @@ -5,7 +5,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::BOGUS]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::BOGUS]', 'isLCP' => false, 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php index c7d8fba7e4..048869df90 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-on-all-breakpoints-but-not-desktop-with-fully-populated-sample-data/set-up.php @@ -26,7 +26,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $non_desktop_viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, @@ -47,7 +47,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.3, ), diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html index cb5f1530a8..4a2eaac7a3 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/expected.html @@ -6,7 +6,7 @@

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php index 3ef73bb716..6653f015f5 100644 --- a/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/background-image-outside-viewport-with-desktop-metrics-missing/set-up.php @@ -24,7 +24,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $non_desktop_viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php index fa65a15bb6..3e76d4ce71 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-and-lazy-loaded-background-image-outside-viewport-with-fully-populated-sample-data/set-up.php @@ -10,18 +10,18 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]', 'isLCP' => true, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[4][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[4][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php index d4e91b99df..cb39822c31 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-background-image-with-fully-populated-sample-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php index 5255188173..ee940eae52 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-and-lazy-loaded-image-outside-viewport-with-fully-populated-sample-data/set-up.php @@ -17,41 +17,41 @@ 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[1][self::IMG]', 'isLCP' => true, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[2][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, // Subsequent carousel slide. ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::DIV]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, // Subsequent carousel slide. ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0 === $i ? 0.5 : 0.0, // Make sure that the _max_ intersection ratio is considered. ), // All are outside all initial viewports. array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[5][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[5][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[6][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[6][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, 'boundingClientRect' => $outside_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[7][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[7][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html index a3efb5a545..51215d05b2 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/expected.html @@ -6,8 +6,8 @@
- Foo - Bar + Foo + Bar
diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php index 33939b37ac..2666fb6ce2 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-fully-incomplete-sample-data/set-up.php @@ -12,11 +12,11 @@ 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'isLCP' => true, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', 'isLCP' => false, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php index 0ccab59cec..60f03a4d6e 100644 --- a/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/common-lcp-image-with-stale-sample-data/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', // Note: This is intentionally not reflecting the IMG in the HTML below. + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', // Note: This is intentionally not reflecting the IMG in the HTML below. 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html index 516fc4bf1c..4e1b0de926 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/expected.html @@ -10,11 +10,11 @@
- Mobile Logo - Phablet Logo - Tablet Logo - Desktop Logo - Desktop Logo + Mobile Logo + Phablet Logo + Tablet Logo + Desktop Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php index e8f0ca8090..4f33479ff6 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-all-breakpoints/set-up.php @@ -13,23 +13,23 @@ static function () use ( $breakpoint_max_widths ) { $elements = array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[4][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[4][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[5][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[5][self::IMG]', ), ); $elements[ $i ]['isLCP'] = true; diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html index f6ca681fae..075275898c 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/expected.html @@ -8,8 +8,8 @@
- Mobile Logo - Desktop Logo + Mobile Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php index 202a68a342..3f0b67e8c7 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-non-consecutive-viewport-groups-with-missing-data-for-middle-group/set-up.php @@ -8,12 +8,12 @@ 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', 'intersectionRatio' => 0.0, ), ), @@ -28,12 +28,12 @@ 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'intersectionRatio' => 0.0, ), array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', 'intersectionRatio' => 1.0, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html index 77ea9669f4..cd3ac13937 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/expected.html @@ -6,9 +6,9 @@
- Mobile Logo + Mobile Logo

New paragraph since URL Metrics were captured!

- Desktop Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php index 6b261511bf..4b7db6cc53 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints-and-one-is-stale/set-up.php @@ -15,11 +15,11 @@ static function () { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -33,11 +33,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -51,11 +51,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -69,11 +69,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html index 7c17417d0c..cbd0491a98 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/expected.html @@ -7,8 +7,8 @@
- Mobile Logo - Desktop Logo + Mobile Logo + Desktop Logo
diff --git a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php index 2f8bf14ee2..9c12a4adf2 100644 --- a/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/different-lcp-elements-for-two-non-consecutive-breakpoints/set-up.php @@ -15,11 +15,11 @@ static function () { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -33,11 +33,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -51,11 +51,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) @@ -69,11 +69,11 @@ static function () { 'elements' => array( array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', ), ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php index 9b3b741779..47f81633e3 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-already-on-common-lcp-image-with-fully-populated-sample-data/set-up.php @@ -4,7 +4,7 @@ array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), ) ); diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html index 0daed966be..1f46f34686 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/expected.html @@ -7,7 +7,7 @@
- Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php index 06a6267862..dba2b3d3ea 100644 --- a/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/fetch-priority-high-on-lcp-image-common-on-mobile-and-desktop-with-url-metrics-missing-in-other-groups/set-up.php @@ -16,7 +16,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 375, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'isLCP' => true, ), ), @@ -31,7 +31,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php b/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php index bd3d8e1ea2..d8cadae667 100644 --- a/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/images-located-above-or-along-initial-viewport/set-up.php @@ -33,28 +33,28 @@ 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $above_viewport_rect, 'boundingClientRect' => $above_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $left_of_viewport_rect, 'boundingClientRect' => $left_of_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $right_of_viewport_rect, 'boundingClientRect' => $right_of_viewport_rect, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[4][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[4][self::IMG]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $below_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php b/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php index 50d5157da3..88c966d7c7 100644 --- a/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/img-non-native-lazy-loading/set-up.php @@ -10,7 +10,7 @@ 'viewport_width' => 1000, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html index 876abe7c78..cf7beb4298 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/expected.html @@ -6,11 +6,11 @@
- - - - - + + + + +
diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php index 7c22f783a9..245364eb4b 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-on-all-breakpoints/set-up.php @@ -18,25 +18,25 @@ static function () use ( $breakpoint_max_widths ) { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.1, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[4][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[4][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html index b0da6ab699..d6b78a2d9d 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/expected.html @@ -6,11 +6,11 @@
- - - - - + + + + +
diff --git a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php index 4773307eb9..65b95a21cd 100644 --- a/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/multiple-videos-with-desktop-metrics-missing/set-up.php @@ -18,25 +18,25 @@ static function () use ( $breakpoint_max_widths ) { 'elements' => array( array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 1.0, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.1, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[3][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[3][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), array( 'isLCP' => false, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[4][self::VIDEO]', + 'xpath' => '/HTML/BODY/DIV/*[4][self::VIDEO]', 'boundingClientRect' => $test_case->get_sample_dom_rect(), 'intersectionRatio' => 0.0, ), diff --git a/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php b/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php index 33ef607ccc..c0a5bf1735 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/no-lcp-image-or-background-image-outside-viewport-with-populated-url-metrics/set-up.php @@ -3,7 +3,7 @@ $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::H1]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::H1]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html b/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html index 3e87268e2e..f85d6cf747 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/no-url-metrics-but-server-side-heuristics-added-fetchpriority-high/expected.html @@ -5,10 +5,10 @@
- Foo - Bar - Baz - Qux + Foo + Bar + Baz + Qux
diff --git a/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html b/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html index 532c59d01d..b62547c485 100644 --- a/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/no-url-metrics/expected.html @@ -5,9 +5,9 @@
- Foo + Foo

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html index db2174a338..9d86483b02 100644 --- a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/expected.html @@ -23,14 +23,14 @@

Last Post

First Post

This post does have a featured image, and the server-side heuristics in WordPress cause it to get fetchpriority=high, but it should not have this since it is out of the viewport on mobile.

Pretend this is a super long paragraph that pushes the next div out of the initial viewport.

-
This is so background!
+
This is so background!
diff --git a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php index 6699e0a2c7..29244432e3 100644 --- a/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/only-mobile-and-desktop-groups-are-populated/set-up.php @@ -27,12 +27,12 @@ static function () { 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::MAIN]/*[2][self::ARTICLE]/*[2][self::FIGURE]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::MAIN]/*[2][self::ARTICLE]/*[2][self::FIGURE]/*[1][self::IMG]', 'isLCP' => $viewport_width > 600, 'intersectionRatio' => $viewport_width > 600 ? 1.0 : 0.1, ), array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[2][self::MAIN]/*[4][self::DIV]', + 'xpath' => '/HTML/BODY/DIV/*[2][self::MAIN]/*[4][self::DIV]', 'isLCP' => false, 'intersectionRatio' => 0.0, 'intersectionRect' => $outside_viewport_rect, diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html index 2005e0583e..3c091020ba 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/expected.html @@ -9,7 +9,7 @@ - Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php index 52b6a8101d..414d90ee61 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing/set-up.php @@ -22,7 +22,7 @@ static function () use ( $breakpoint_max_widths ) { 'viewport_width' => $viewport_width, 'elements' => array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::PICTURE]/*[3][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[3][self::IMG]', 'isLCP' => true, ), ), diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php index db243b1d83..cb673b547d 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-lcp-image-and-fully-populated-sample-data/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php index db243b1d83..cb673b547d 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-having-media-attribute/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php index db243b1d83..cb673b547d 100644 --- a/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/picture-element-with-source-missing-type-attribute/set-up.php @@ -12,7 +12,7 @@ static function () use ( $breakpoint_max_widths ) { $test_case->populate_url_metrics( array( array( - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::PICTURE]/*[2][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::PICTURE]/*[2][self::IMG]', 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php b/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php index 68f281a119..f31160ed01 100644 --- a/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/responsive-background-images/set-up.php @@ -26,7 +26,7 @@ static function () use ( $mobile_breakpoint, $tablet_breakpoint ): array { array( 'viewport_width' => $viewport_width, 'element' => array( - 'xpath' => sprintf( '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[%d][self::DIV]', $div_index + 1 ), + 'xpath' => sprintf( '/HTML/BODY/DIV/*[%d][self::DIV]', $div_index + 1 ), 'isLCP' => true, ), ) diff --git a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html index 03b7499cfb..d0dd1329d3 100644 --- a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/expected.html @@ -8,7 +8,7 @@
- Foo + Foo
diff --git a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php index a1923410c4..568a112cd2 100644 --- a/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php +++ b/plugins/image-prioritizer/tests/test-cases/url-metric-only-captured-for-one-breakpoint/set-up.php @@ -7,7 +7,7 @@ 'viewport_width' => 400, 'element' => array( 'isLCP' => true, - 'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::DIV]/*[1][self::IMG]', + 'xpath' => '/HTML/BODY/DIV/*[1][self::IMG]', ), ) ) diff --git a/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html b/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html index 1d0006046e..648472749f 100644 --- a/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html +++ b/plugins/image-prioritizer/tests/test-cases/video-with-large-poster-and-desktop-url-metrics-collected/expected.html @@ -5,7 +5,7 @@
-