[wp-trac] [WordPress Trac] #32793: Combine jQuery and jQuery migrate to reduce HTTP requests
WordPress Trac
noreply at wordpress.org
Sat Jun 10 10:27:09 UTC 2017
#32793: Combine jQuery and jQuery migrate to reduce HTTP requests
--------------------------------+--------------------------------------
Reporter: peterwilsoncc | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: External Libraries | Version: 3.6
Severity: normal | Resolution: wontfix
Keywords: needs-refresh | Focuses: javascript, performance
--------------------------------+--------------------------------------
Comment (by jhabdas):
See Feb 2017 update at beginning of post:
https://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/.
Post originally authored by Chris Coyier. Not sure who made the edit.
Here's what's being suggested as "the right way" of including jQuery:
{{{#!php
// include custom jQuery
function shapeSpace_include_custom_jquery() {
wp_deregister_script('jquery');
wp_enqueue_script('jquery',
'https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js',
array(), null, true);
}
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery');
}}}
Because `jquery` handle object has dependencies on `jquery-migrate` and
`jquery-core` this approach listed on the post of a well-respected author
has the following impacts:
- Removes migrate entirely by rewriting the `jquery` handle object
- Removes core jQuery by rewriting the `jquery` handle object
- Adds jQuery without `vers`, which could impact cache busting
- Proposes loading jQuery from CDN, which introduces a SPOF for adopting
sites
- Introduces potential security risks as Subresource integrity is not used
Just thought I'd make a note of it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32793#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list