wp/wp-includes/js/wp-emoji.js
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
--- a/wp/wp-includes/js/wp-emoji.js	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/js/wp-emoji.js	Fri Sep 05 18:40:08 2025 +0200
@@ -145,17 +145,6 @@
 								node = node.parentNode;
 							}
 
-							/*
-							 * If the class name of a non-element node contains 'wp-exclude-emoji' ignore it.
-							 *
-							 * Node type 1 is an ELEMENT_NODE.
-							 */
-							if ( ! node || node.nodeType !== 1 ||
-								( node.className && typeof node.className === 'string' && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
-
-								continue;
-							}
-
 							if ( test( node.textContent ) ) {
 								parse( node );
 							}
@@ -263,6 +252,19 @@
 						this.setAttribute( 'data-error', 'load-failed' );
 						twemoji.parentNode.replaceChild( document.createTextNode( twemoji.alt ), twemoji );
 					}
+				},
+				doNotParse: function( node ) {
+					if (
+						node &&
+						node.className &&
+						typeof node.className === 'string' &&
+						node.className.indexOf( 'wp-exclude-emoji' ) !== -1
+					) {
+						// Do not parse this node. Emojis will not be replaced in this node and all sub-nodes.
+						return true;
+					}
+
+					return false;
 				}
 			};