wp/wp-includes/js/wp-emoji.js
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   143 								}
   143 								}
   144 
   144 
   145 								node = node.parentNode;
   145 								node = node.parentNode;
   146 							}
   146 							}
   147 
   147 
   148 							/*
       
   149 							 * If the class name of a non-element node contains 'wp-exclude-emoji' ignore it.
       
   150 							 *
       
   151 							 * Node type 1 is an ELEMENT_NODE.
       
   152 							 */
       
   153 							if ( ! node || node.nodeType !== 1 ||
       
   154 								( node.className && typeof node.className === 'string' && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
       
   155 
       
   156 								continue;
       
   157 							}
       
   158 
       
   159 							if ( test( node.textContent ) ) {
   148 							if ( test( node.textContent ) ) {
   160 								parse( node );
   149 								parse( node );
   161 							}
   150 							}
   162 						}
   151 						}
   163 					}
   152 					}
   261 				onerror: function() {
   250 				onerror: function() {
   262 					if ( twemoji.parentNode ) {
   251 					if ( twemoji.parentNode ) {
   263 						this.setAttribute( 'data-error', 'load-failed' );
   252 						this.setAttribute( 'data-error', 'load-failed' );
   264 						twemoji.parentNode.replaceChild( document.createTextNode( twemoji.alt ), twemoji );
   253 						twemoji.parentNode.replaceChild( document.createTextNode( twemoji.alt ), twemoji );
   265 					}
   254 					}
       
   255 				},
       
   256 				doNotParse: function( node ) {
       
   257 					if (
       
   258 						node &&
       
   259 						node.className &&
       
   260 						typeof node.className === 'string' &&
       
   261 						node.className.indexOf( 'wp-exclude-emoji' ) !== -1
       
   262 					) {
       
   263 						// Do not parse this node. Emojis will not be replaced in this node and all sub-nodes.
       
   264 						return true;
       
   265 					}
       
   266 
       
   267 					return false;
   266 				}
   268 				}
   267 			};
   269 			};
   268 
   270 
   269 			if ( typeof args.imgAttr === 'object' ) {
   271 			if ( typeof args.imgAttr === 'object' ) {
   270 				params.attributes = function() {
   272 				params.attributes = function() {