Emoji: fix loop when replacement images fail to load.

Props iseulde. Fixes #32128 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@32323 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-04-29 03:19:01 +00:00
parent 342989657f
commit f31aeb97f1
1 changed files with 14 additions and 3 deletions

View File

@ -61,13 +61,24 @@
if ( MutationObserver ) { if ( MutationObserver ) {
new MutationObserver( function( mutationRecords ) { new MutationObserver( function( mutationRecords ) {
var i = mutationRecords.length, var i = mutationRecords.length,
ii, node; addedNodes, removedNodes, ii, node;
while ( i-- ) { while ( i-- ) {
ii = mutationRecords[ i ].addedNodes.length; addedNodes = mutationRecords[ i ].addedNodes;
removedNodes = mutationRecords[ i ].removedNodes;
ii = addedNodes.length;
if (
ii === 1 && removedNodes.length === 1 &&
addedNodes[0].nodeType === 3 &&
removedNodes[0].nodeName === 'IMG' &&
addedNodes[0].data === removedNodes[0].alt
) {
return;
}
while ( ii-- ) { while ( ii-- ) {
node = mutationRecords[ i ].addedNodes[ ii ]; node = addedNodes[ ii ];
if ( node.nodeType === 3 ) { if ( node.nodeType === 3 ) {
node = node.parentNode; node = node.parentNode;