File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
plugins/optimization-detective Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -456,19 +456,18 @@ public function get_common_lcp_element(): ?OD_Element {
456
456
||
457
457
$ first_group_lcp_element ->get_xpath () !== $ last_group_lcp_element ->get_xpath ()
458
458
) {
459
- return null ; // No common LCP element across the narrowest and widest viewports.
459
+ return null ; // No common LCP element across the narrowest and widest viewports.
460
460
}
461
461
462
462
// Check intermediate viewport groups for conflicting LCP elements.
463
- $ num_groups = count ( $ this ->groups );
464
- for ( $ i = 1 ; $ i < $ num_groups - 1 ; $ i ++ ) {
465
- $ group_lcp_element = $ this ->groups [ $ i ]->get_lcp_element ();
463
+ foreach ( array_slice ( $ this ->groups , 1 , -1 ) as $ group ) {
464
+ $ group_lcp_element = $ group ->get_lcp_element ();
466
465
if (
467
466
$ group_lcp_element instanceof OD_Element
468
467
&&
469
468
$ group_lcp_element ->get_xpath () !== $ first_group_lcp_element ->get_xpath ()
470
469
) {
471
- return null ; // Conflicting LCP element found in an intermediate group.
470
+ return null ; // Conflicting LCP element found in an intermediate group.
472
471
}
473
472
}
474
473
You can’t perform that action at this time.
0 commit comments