[wp-trac] [WordPress Trac] #31701: Emoji: Avoid enqueueing JS by default

WordPress Trac noreply at wordpress.org
Mon Mar 23 04:42:32 UTC 2015


#31701: Emoji: Avoid enqueueing JS by default
-----------------------------+--------------------------------------
 Reporter:  obenland         |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  4.2
Component:  General          |     Version:  trunk
 Severity:  major            |  Resolution:
 Keywords:  emoji has-patch  |     Focuses:  javascript, performance
-----------------------------+--------------------------------------

Comment (by pento):

 In [attachment:31701.6.diff]:

 * Switched the initial emoji parse to the `readystatechange` event,
 instead of the `load` event.
 * After `wp-emoji-loader.js` determines emoji support, it sets that info
 on `window._wpemojiSettings`, which is then reused by  `wp-emoji.js`.
 * As a result, I've removed `browserSupportsEmoji()` from `wp-emoji.js`.
 * Fixed `waitForTwemoji()` incorrectly adding many `<script>` nodes.



 Things for feedback:

 * Is `wp-emoji-loader.js` the correct name for our loader file?
 * I'm not sure about using `readfile()` in production - can we guarantee
 the JS file will be available on the same FS? Maybe it'd be better to have
 `grunt build` manually write the minified JS to `formatting.php`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31701#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list