Skip to content

Commit

Permalink
Add typing for resizedBoundingClientRect
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Oct 17, 2024
1 parent 8992957 commit a99208b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/**
* Tag visitor that optimizes embeds.
*
* @phpstan-import-type DOMRect from OD_URL_Metric
*
* @since 0.2.0
* @access private
*/
Expand Down Expand Up @@ -216,6 +218,11 @@ private function reduce_layout_shifts( OD_Tag_Visitor_Context $context ): void {

$elements = $context->url_metric_group_collection->get_all_elements()[ $embed_wrapper_xpath ] ?? array();
foreach ( $elements as $element ) {
/**
* Resized bounding client rect.
*
* @var DOMRect|null $resized_bounding_client_rect
*/
$resized_bounding_client_rect = $element->get( 'resizedBoundingClientRect' );
if ( ! is_array( $resized_bounding_client_rect ) ) {
continue;
Expand Down

0 comments on commit a99208b

Please sign in to comment.