diff --git src/wp-includes/js/wp-emoji-loader.js src/wp-includes/js/wp-emoji-loader.js
index 8291c5b4cf..9faa0c5bd8 100644
|
|
|
1 | 1 | ( function( window, document, settings ) { |
2 | 2 | var src, ready, ii, tests; |
3 | 3 | |
4 | | /* |
5 | | * Create a canvas element for testing native browser support |
6 | | * of emoji. |
7 | | */ |
| 4 | |
| 5 | //Create a canvas element for testing native browser support of emoji. |
8 | 6 | var canvas = document.createElement( 'canvas' ); |
9 | 7 | var context = canvas.getContext && canvas.getContext( '2d' ); |
10 | 8 | |
11 | 9 | /** |
12 | 10 | * Check if two sets of Emoji characters render the same. |
13 | 11 | * |
14 | | * @param set1 array Set of Emoji characters. |
15 | | * @param set2 array Set of Emoji characters. |
| 12 | * @ignore |
| 13 | * |
| 14 | * @since 4.9.0 |
| 15 | * |
| 16 | * @param {array} set1 Set of Emoji characters. |
| 17 | * @param {array} set2 Set of Emoji characters. |
16 | 18 | * @returns {boolean} True if the two sets render the same. |
17 | 19 | */ |
18 | 20 | function emojiSetsRenderIdentically( set1, set2 ) { |
… |
… |
|
32 | 34 | } |
33 | 35 | |
34 | 36 | /** |
35 | | * Detect if the browser supports rendering emoji or flag emoji. Flag emoji are a single glyph |
36 | | * made of two characters, so some browsers (notably, Firefox OS X) don't support them. |
| 37 | * Detect if the browser supports rendering emoji or flag emoji. |
| 38 | * |
| 39 | * Flag emoji are a single glyph made of two characters, |
| 40 | * so some browsers (notably, Firefox OS X) don't support them. |
| 41 | * |
| 42 | * @ignore |
37 | 43 | * |
38 | 44 | * @since 4.2.0 |
39 | 45 | * |
40 | | * @param type {String} Whether to test for support of "flag" or "emoji". |
41 | | * @return {Boolean} True if the browser can render emoji, false if it cannot. |
| 46 | * @param {string} type Whether to test for support of "flag" or "emoji". |
| 47 | * @return {boolean} True if the browser can render emoji, false if it cannot. |
42 | 48 | */ |
43 | 49 | function browserSupportsEmoji( type ) { |
44 | 50 | var isIdentical; |
… |
… |
|
103 | 109 | |
104 | 110 | return false; |
105 | 111 | } |
106 | | |
| 112 | /** |
| 113 | * Adds a script to the head of the document. |
| 114 | * |
| 115 | * @ignore |
| 116 | * |
| 117 | * @since 4.2.0 |
| 118 | * |
| 119 | * @param {object} src The path where the script is located. |
| 120 | * @return {void} |
| 121 | */ |
107 | 122 | function addScript( src ) { |
108 | 123 | var script = document.createElement( 'script' ); |
109 | 124 | |
… |
… |
|
114 | 129 | |
115 | 130 | tests = Array( 'flag', 'emoji' ); |
116 | 131 | |
| 132 | // Defines the initial values to the supports prop of settings. |
117 | 133 | settings.supports = { |
118 | 134 | everything: true, |
119 | 135 | everythingExceptFlag: true |
120 | 136 | }; |
121 | 137 | |
| 138 | // Tests the browser support for flag emojis and other emojis, and adjusts the support settings accordingly. |
122 | 139 | for( ii = 0; ii < tests.length; ii++ ) { |
123 | 140 | settings.supports[ tests[ ii ] ] = browserSupportsEmoji( tests[ ii ] ); |
124 | 141 | |
… |
… |
|
131 | 148 | |
132 | 149 | settings.supports.everythingExceptFlag = settings.supports.everythingExceptFlag && ! settings.supports.flag; |
133 | 150 | |
| 151 | // Sets DOMReady to false and assigns a ready function to settings. |
134 | 152 | settings.DOMReady = false; |
135 | 153 | settings.readyCallback = function() { |
136 | 154 | settings.DOMReady = true; |
137 | 155 | }; |
138 | 156 | |
| 157 | // When the browser can not render everything... |
139 | 158 | if ( ! settings.supports.everything ) { |
140 | 159 | ready = function() { |
141 | 160 | settings.readyCallback(); |
142 | 161 | }; |
143 | 162 | |
| 163 | // Tests whether a document.addEventListener exists. This is the case for IE < 9. |
| 164 | // On the load events set settings.DOMReady to true. |
144 | 165 | if ( document.addEventListener ) { |
145 | 166 | document.addEventListener( 'DOMContentLoaded', ready, false ); |
146 | 167 | window.addEventListener( 'load', ready, false ); |
… |
… |
|
153 | 174 | } ); |
154 | 175 | } |
155 | 176 | |
| 177 | // Adds scripts to the DOM if they are present in the settings. |
156 | 178 | src = settings.source || {}; |
157 | 179 | |
158 | 180 | if ( src.concatemoji ) { |