mirror of
https://github.com/twitter/twemoji.git
synced 2025-08-03 22:56:40 +09:00
do not change nodes if not needed
This commit is contained in:
@ -327,6 +327,7 @@ define(function () {
|
||||
var
|
||||
allText = grabAllTextNodes(node, []),
|
||||
length = allText.length,
|
||||
modified = false,
|
||||
fragment,
|
||||
subnode,
|
||||
text,
|
||||
@ -367,13 +368,15 @@ define(function () {
|
||||
img.setAttribute('draggable', 'false');
|
||||
img.alt = alt;
|
||||
img.src = src;
|
||||
modified = true;
|
||||
fragment.appendChild(img);
|
||||
}
|
||||
}
|
||||
fragment.appendChild(img || createText(alt));
|
||||
if (!img) fragment.appendChild(createText(alt));
|
||||
img = null;
|
||||
}
|
||||
// is there actually anything to replace in here ?
|
||||
if (0 < i) {
|
||||
if (modified) {
|
||||
// any text left to be added ?
|
||||
if (i < text.length) {
|
||||
fragment.appendChild(
|
||||
|
Reference in New Issue
Block a user