Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: collect fetchpriority for images and link rel preload #14925

Merged
merged 4 commits into from
Mar 23, 2023

Conversation

brendankenny
Copy link
Member

To support #13738, gathers the fetchpriority hint in the ImageElements and LinkElements gatherers. Not used yet, but asserted in smoke tests.

@brendankenny brendankenny requested a review from a team as a code owner March 23, 2023 17:36
@brendankenny brendankenny requested review from adamraine and removed request for a team March 23, 2023 17:36
@@ -219,8 +219,7 @@ <h2 id="toppy" style="background-image:url('');">Do better web tester page</h2>
<!-- FAIL(image-aspect-ratio): image is naturally 1024x680 -->
<img src="lighthouse-1024x680.jpg?iar1" width="120" height="15">
<!-- PASS(image-aspect-ratio) -->
<!-- FAIL(lcp-lazy-loaded) -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old comment; this isn't the LCP and doesn't fail that audit :)

attributeHeight: '80',
naturalDimensions: {
width: 1024,
height: 678,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice the image is called lighthouse-1024x680.jpg... :P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the file name is just misleading?

Copy link
Member Author

@brendankenny brendankenny Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the file name is just misleading?

yes, but to be fair, it's copied from the byte-efficiency smoke test image of the same name, which is (we're now learning) also actually 1024x678, added wayyyy back in #1635

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah not suggesting we change it here, just wanted to confirm

attributeHeight: '80',
naturalDimensions: {
width: 1024,
height: 678,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the file name is just misleading?

@@ -70,6 +70,8 @@ function getLinkElementsInDOM() {
crossOrigin: link.crossOrigin,
hrefRaw,
source,
// @ts-expect-error - Not in tsc types yet.
fetchPriority: link.fetchPriority,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add an internal type declaration for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add an internal type declaration for this?

Yeah, it felt like overkill because it's part of the html spec and so it will eventually get rolled up into the tsc types, but OTOH @ts-expect-error is pretty heavy handed. Added to the DOM types in the somewhat misleadingly named node.d.ts

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants