[wp-trac] [WordPress Trac] #34292: Support for DNS Prefetching & Prerender
WordPress Trac
noreply at wordpress.org
Tue Jun 28 22:10:41 UTC 2016
#34292: Support for DNS Prefetching & Prerender
--------------------------------------+-----------------------------
Reporter: bhubbard | Owner: voldemortensen
Type: feature request | Status: assigned
Priority: normal | Milestone: 4.6
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+-----------------------------
Comment (by voldemortensen):
Replying to [comment:32 swissspidy]:
> [attachment:34292.6.diff] is an alternative patch with a more simplified
approach.
>
> * Changes the naming of the function to `wp_resource_hints()`, as
`wp_browser_hints()` to me sounds like a browsehappy.com browser nag.
Resource hints is more accurate.
> * Moves the admin parts into that function as it's only a few lines of
code and not much added complexity.
> * Simplifies the logic to get rid of `unique_browser_hints()` and
`add_prefetch_attr()`
> * Improves unit tests to test the admin parts as well. Moves the various
`$preexpected` assertions to a separate test.
> * Adds one single `wp_resource_hints` filter.
+1 to all of this
>
> To do:
>
> * Add test for scripts and styles enqueuing.
> * Add assertion for the `parse_url()` part for `dns-prefetch`
> * Decide whether the filter makes sense inside the `foreach` loop or if
it should be outside.
I think the filter should be kept inside the foreach. If I understand
correctly, that would make it easier to filter based on
preconnect/prefetch/prerender/etc, instead of having to deal with multiple
arrays and making sure to return the whole array of arrays instead of just
your modified part.
IMO, once the tests are written for those pieces this is good for commit.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34292#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list