Skip to content

Commit 6e9bb16

Browse files
committed
Use is_admin_bar since faaster than computing XPath for every tag
1 parent 5aae390 commit 6e9bb16

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plugins/optimization-detective/class-od-html-tag-processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ public function get_stored_xpath(): string {
715715
*
716716
* @return bool Whether at or inside the admin bar.
717717
*/
718-
private function is_admin_bar(): bool {
718+
public function is_admin_bar(): bool {
719719
return (
720720
isset( $this->open_stack_tags[2], $this->open_stack_attributes[2]['id'] )
721721
&&

plugins/optimization-detective/optimization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function od_optimize_template_output_buffer( string $buffer ): string {
359359
if (
360360
in_array( 'NOSCRIPT', $processor->get_breadcrumbs(), true )
361361
||
362-
str_starts_with( $processor->get_stored_xpath(), "/HTML/BODY/DIV[@id='wpadminbar']" )
362+
$processor->is_admin_bar()
363363
) {
364364
continue;
365365
}

0 commit comments

Comments
 (0)