diff --git a/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php b/plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php index 32f80c875..6c4b248dc 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 c48b20459..cb8b50e3c 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 2525c6d23..6ea4d7f7c 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 2a29e765e..ba37caa5c 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 2a6649554..e91b7b75c 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 2fb1521fe..412e1e9a8 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 e53cb2184..a41674725 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 1cc2c139b..2f9f6d1f0 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 f30033581..6c44678b8 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 682ccfc26..1fd211c23 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 a0ef7685f..d55d88ef8 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 9f87b44a6..0da100a0b 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 08e66b88d..24ec36b5b 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 4847aca6f..1a536025b 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 a8d6b7c4c..cf6d4a12e 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 7acbe1f10..5cb633e32 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 d048bbfcf..7b706664c 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 2a6649554..e91b7b75c 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 b16583acb..400790d6e 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 102d5f8b1..bad024fc5 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 7356a2376..d159a1ddf 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 1cc2c139b..2f9f6d1f0 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 d861c6386..e207715e3 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 c52c6729c..71fa110a0 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 73331474b..7badfa2ad 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 bc1953084..c192b91d6 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 a6305e08d..58f90072c 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 9f87b44a6..0da100a0b 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 ab7c7ea09..999512d0a 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 60d662e15..bf8f66d63 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 c7d8fba7e..048869df9 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 cb5f1530a..4a2eaac7a 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 3ef73bb71..6653f015f 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 fa65a15bb..3e76d4ce7 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 d4e91b99d..cb39822c3 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 525518817..ee940eae5 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 a3efb5a54..51215d05b 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 33939b37a..2666fb6ce 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 0ccab59ce..60f03a4d6 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 516fc4bf1..4e1b0de92 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 e8f0ca809..4f33479ff 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 f6ca681fa..075275898 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 202a68a34..3f0b67e8c 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 77ea9669f..cd3ac1393 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 6b261511b..4b7db6cc5 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 7c17417d0..cbd0491a9 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 2f8bf14ee..9c12a4adf 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 9b3b74177..47f81633e 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 0daed966b..1f46f3468 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 06a626786..dba2b3d3e 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 bd3d8e1ea..d8cadae66 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 50d5157da..88c966d7c 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 876abe7c7..cf7beb429 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 7c22f783a..245364eb4 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 b0da6ab69..d6b78a2d9 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 4773307eb..65b95a21c 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 33ef607cc..c0a5bf173 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 3e87268e2..f85d6cf74 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 532c59d01..b62547c48 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 db2174a33..9d86483b0 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 6699e0a2c..29244432e 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 2005e0583..3c091020b 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 52b6a8101..414d90ee6 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 db243b1d8..cb673b547 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 db243b1d8..cb673b547 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 db243b1d8..cb673b547 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 68f281a11..f31160ed0 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 03b7499cf..d0dd1329d 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 a1923410c..568a112cd 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 1d0006046..648472749 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 @@
-