Index: /branches/4.8/src/wp-includes/js/twemoji.js
===================================================================
--- /branches/4.8/src/wp-includes/js/twemoji.js (revision 41393)
+++ /branches/4.8/src/wp-includes/js/twemoji.js (revision 41394)
@@ -89,5 +89,5 @@
onerror: function onerror() {
if (this.parentNode) {
- this.parentNode.replaceChild(createText(this.alt), this);
+ this.parentNode.replaceChild(createText(this.alt, false), this);
}
},
@@ -160,5 +160,5 @@
*
* twemoji.parse("I \u2764\uFE0F emoji!");
- * // I emoji!
+ * // I emoji!
*
*
@@ -166,5 +166,5 @@
* return '/assets/' + iconId + '.gif';
* });
- * // I emoji!
+ * // I emoji!
*
*
@@ -175,5 +175,5 @@
* }
* });
- * // I emoji!
+ * // I emoji!
*
*/
@@ -238,6 +238,6 @@
rescaper = /[&<>'"]/g,
- // nodes with type 1 which should **not** be parsed (including lower case svg)
- shouldntBeParsed = /IFRAME|NOFRAMES|NOSCRIPT|SCRIPT|SELECT|STYLE|TEXTAREA|[a-z]/,
+ // nodes with type 1 which should **not** be parsed
+ shouldntBeParsed = /^(?:iframe|noframes|noscript|script|select|style|textarea)$/,
// just a private shortcut
@@ -257,6 +257,6 @@
* @return Node a DOM node with that text
*/
- function createText(text) {
- return document.createTextNode(text);
+ function createText(text, clean) {
+ return document.createTextNode(clean ? text.replace(UFE0Fg, '') : text);
}
@@ -302,7 +302,8 @@
allText.push(subnode);
}
- // ignore all nodes that are not type 1 or that
+ // ignore all nodes that are not type 1, that are svg, or that
// should not be parsed as script, style, and others
- else if (nodeType === 1 && !shouldntBeParsed.test(subnode.nodeName)) {
+ else if (nodeType === 1 && !('ownerSVGElement' in subnode) &&
+ !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) {
grabAllTextNodes(subnode, allText);
}
@@ -366,5 +367,5 @@
if (index !== i) {
fragment.appendChild(
- createText(text.slice(i, index))
+ createText(text.slice(i, index), true)
);
}
@@ -394,5 +395,5 @@
fragment.appendChild(img);
}
- if (!img) fragment.appendChild(createText(rawText));
+ if (!img) fragment.appendChild(createText(rawText, false));
img = null;
}
@@ -402,5 +403,5 @@
if (i < text.length) {
fragment.appendChild(
- createText(text.slice(i))
+ createText(text.slice(i), true)
);
}
@@ -460,5 +461,5 @@
}
}
- ret = ret.concat('>');
+ ret = ret.concat('/>');
}
return ret;