WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#37385 closed defect (bug) (fixed)

Resource hinting: only dns-prefetch enqueued resources.

Reported by: peterwilsoncc Owned by: peterwilsoncc
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.6
Component: Script Loader Keywords: commit
Focuses: Cc:
PR Number:

Description

dns-prefetch link elements are currently created for all registered depenedencies, only create them for enqueued dependencies.

Attachments (1)

37385.diff (3.1 KB) - added by peterwilsoncc 3 years ago.
code: swissspidy, tests: peterwilsoncc

Download all attachments as: .zip

Change History (8)

#1 @swissspidy
3 years ago

Isn't there already a fix for that in another ticket? Can't find it right now though.

@peterwilsoncc
3 years ago

code: swissspidy, tests: peterwilsoncc

#2 @peterwilsoncc
3 years ago

@swissspidy there is in #34292 but forking it because it's become a bit of a super ticket.

I've brought the code across in 37385.diff, props due are code: @swissspidy, tests: @peterwilsoncc

#3 @voldemortensen
3 years ago

  • Keywords commit added

#4 @peterwilsoncc
3 years ago

  • Owner set to peterwilsoncc
  • Status changed from new to assigned

#5 @peterwilsoncc
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38100:

Script Loader: Limit resource hinting to enqueued assets.

Externally hosted script and style dependencies trigger dns-prefetch hinting only when enqueued. This removed a bug in which hinting was added on registration.

Renames the function wp_resource_hints_scripts_styles to wp_dependencies_unique_hosts as the function provides the hosts, not the hinting.

Props swissspidy.
Fixes #37385.

#6 follow-up: @swissspidy
3 years ago

Should the function be called wp_get_dependencies_unique_hosts() as suggested in 50:ticket:34292?

#7 in reply to: ↑ 6 @peterwilsoncc
3 years ago

Replying to swissspidy:

Should the function be called wp_get_dependencies_unique_hosts() as suggested in 50:ticket:34292?

I'm am not sure.

I think of the get_ and the_ prefixes as being somehow different but I can not explain how so succinctly. The prefixes put me in mind of WP objects, usually posts, whereas wp_[get_]dependencies_unique_hosts works at a higher level within WordPress itself.

As I say, I am not sure.

Note: See TracTickets for help on using tickets.