[wp-trac] [WordPress Trac] #37817: Emoji code not loaded responsibly
WordPress Trac
noreply at wordpress.org
Thu Sep 1 17:59:11 UTC 2016
#37817: Emoji code not loaded responsibly
---------------------------+------------------------------
Reporter: superpoincare | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Emoji | Version: 4.6
Severity: normal | Resolution:
Keywords: | Focuses: performance
---------------------------+------------------------------
Comment (by tollmanz):
I would also like to recommend that the emoji script is loaded more
responsibly. Proving the impact via WPT/Dev
Tools/{$your_favorite_profiler} is really tricky and likely to lead to bad
decisions. I recently observed a 3 second delay in HTML parsing due to the
emoji load, but have had a heck of a time reproducing that same result.
These types of tests are subject to network, hardware, site construction,
and other random variance that makes specific questions like these nearly
impossible to answer.
The issue is that the JS is loaded in both a render and HTML parser
blocking manner. This means that under the right conditions, the impact of
this seemingly innocuous script could be quite dramatic. As developers,
when we know best practices for a specific problem, we should default to
those practices and argue to not do them if we are so compelled.
I would recommend that we include an `async` attribute to the `script` tag
that wraps the emoji JS, as well as add an `async` attribute to the
`script` that it potentially loads (`defer` would be even better, but it
does not enjoy great cross-browser support). Further, the script should be
loaded in the `wp_footer`, instead of the `wp_head`.
If there are compatibility concerns, we could add some filters to allow
people to change the behavior. We should strive to follow best practices
for performant loading of this script, regardless of how minor the impact
may be.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37817#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list