wp/wp-includes/js/wp-emoji.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 21 48c4eec2b7e6
--- a/wp/wp-includes/js/wp-emoji.js	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/js/wp-emoji.js	Tue Dec 15 13:49:49 2020 +0100
@@ -9,8 +9,8 @@
 	/**
 	 * Replaces emoji with images when browsers don't support emoji.
 	 *
-	 * @since      4.2.0
-	 * @access     private
+	 * @since 4.2.0
+	 * @access private
 	 *
 	 * @class
 	 *
@@ -22,10 +22,10 @@
 	function wpEmoji() {
 		var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
 
-		// Compression and maintain local scope
+		// Compression and maintain local scope.
 		document = window.document,
 
-		// Private
+		// Private.
 		twemoji, timer,
 		loaded = false,
 		count = 0,
@@ -69,7 +69,7 @@
 
 			// Ensure twemoji is available on the global window before proceeding.
 			if ( typeof window.twemoji === 'undefined' ) {
-				// Break if waiting for longer than 30 sec.
+				// Break if waiting for longer than 30 seconds.
 				if ( count > 600 ) {
 					return;
 				}
@@ -245,14 +245,19 @@
 					}
 
 					if ( settings.supports.everythingExceptFlag &&
-						! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) && // Country flags
-						! /^(1f3f3-fe0f-200d-1f308|1f3f4-200d-2620-fe0f)$/.test( icon )             // Rainbow and pirate flags
+						! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) && // Country flags.
+						! /^(1f3f3-fe0f-200d-1f308|1f3f4-200d-2620-fe0f)$/.test( icon )             // Rainbow and pirate flags.
 					) {
 						return false;
 					}
 
 					return ''.concat( options.base, icon, options.ext );
 				},
+				attributes: function() {
+					return {
+						role: 'img'
+					};
+				},
 				onerror: function() {
 					if ( twemoji.parentNode ) {
 						this.setAttribute( 'data-error', 'load-failed' );