-
Notifications
You must be signed in to change notification settings - Fork 139
Labels
[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin onlyIssue relates to work in the Performance Lab Plugin only[Type] BugAn existing feature is brokenAn existing feature is broken
Milestone
Description
See support topic.
Given a site with the following HTML:
<link rel='stylesheet' id='companion-bundle-css' href="" data-href='http://example.com/style.css' type='text/css' media='all' />This is showing up as an error:
Note that the audit currently is accounting for async CSS whereby the media is set to something other than screen or all:
performance/plugins/performance-lab/includes/site-health/audit-enqueued-assets/helper.php
Lines 110 to 132 in f7846e4
| } elseif ( 'LINK' === $tag ) { | |
| $rel = $processor->get_attribute( 'rel' ); | |
| if ( 'stylesheet' !== strtolower( (string) $rel ) ) { | |
| continue; | |
| } | |
| $media = $processor->get_attribute( 'media' ); | |
| if ( is_string( $media ) && 1 !== preg_match( '/^\s*(all|screen)\b/i', $media ) ) { | |
| continue; | |
| } | |
| $href = $processor->get_attribute( 'href' ); | |
| if ( ! is_string( $href ) ) { | |
| continue; | |
| } | |
| $size = perflab_aea_get_asset_size( $href ); | |
| $result['assets']['styles'][] = array( | |
| 'src' => $href, | |
| 'size' => is_wp_error( $size ) ? null : $size, | |
| 'error' => is_wp_error( $size ) ? $size : null, | |
| ); | |
| } |
Normally this is accompanied by an onload attribute on the LINK tag to rewrite the media to screen from something like print when the stylesheet has loaded.
We should also account for this case where the href is empty.
b1ink0
Metadata
Metadata
Assignees
Labels
[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin onlyIssue relates to work in the Performance Lab Plugin only[Type] BugAn existing feature is brokenAn existing feature is broken
Type
Projects
Status
To Do 🔧