diff --git a/src/wp-includes/js/twemoji.js b/src/wp-includes/js/twemoji.js
index 19c2ef48a1..8535099b89 100644
|
a
|
b
|
var twemoji = (function ( |
| 88 | 88 | */ |
| 89 | 89 | onerror: function onerror() { |
| 90 | 90 | if (this.parentNode) { |
| 91 | | this.parentNode.replaceChild(createText(this.alt), this); |
| | 91 | this.parentNode.replaceChild(createText(this.alt, false), this); |
| 92 | 92 | } |
| 93 | 93 | }, |
| 94 | 94 | |
| … |
… |
var twemoji = (function ( |
| 159 | 159 | * @example |
| 160 | 160 | * |
| 161 | 161 | * twemoji.parse("I \u2764\uFE0F emoji!"); |
| 162 | | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/2764.gif"> emoji! |
| | 162 | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/2764.gif"/> emoji! |
| 163 | 163 | * |
| 164 | 164 | * |
| 165 | 165 | * twemoji.parse("I \u2764\uFE0F emoji!", function(iconId, options) { |
| 166 | 166 | * return '/assets/' + iconId + '.gif'; |
| 167 | 167 | * }); |
| 168 | | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/2764.gif"> emoji! |
| | 168 | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/2764.gif"/> emoji! |
| 169 | 169 | * |
| 170 | 170 | * |
| 171 | 171 | * twemoji.parse("I \u2764\uFE0F emoji!", { |
| … |
… |
var twemoji = (function ( |
| 174 | 174 | * return '/assets/' + options.size + '/' + iconId + options.ext; |
| 175 | 175 | * } |
| 176 | 176 | * }); |
| 177 | | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/72x72/2764.png"> emoji! |
| | 177 | * // I <img class="emoji" draggable="false" alt="❤️" src="/assets/72x72/2764.png"/> emoji! |
| 178 | 178 | * |
| 179 | 179 | */ |
| 180 | 180 | parse: parse, |
| … |
… |
var twemoji = (function ( |
| 237 | 237 | // used to find HTML special chars in attributes |
| 238 | 238 | rescaper = /[&<>'"]/g, |
| 239 | 239 | |
| 240 | | // nodes with type 1 which should **not** be parsed (including lower case svg) |
| 241 | | shouldntBeParsed = /IFRAME|NOFRAMES|NOSCRIPT|SCRIPT|SELECT|STYLE|TEXTAREA|[a-z]/, |
| | 240 | // nodes with type 1 which should **not** be parsed |
| | 241 | shouldntBeParsed = /^(?:iframe|noframes|noscript|script|select|style|textarea)$/, |
| 242 | 242 | |
| 243 | 243 | // just a private shortcut |
| 244 | 244 | fromCharCode = String.fromCharCode; |
| … |
… |
var twemoji = (function ( |
| 256 | 256 | * @param string text used to create DOM text node |
| 257 | 257 | * @return Node a DOM node with that text |
| 258 | 258 | */ |
| 259 | | function createText(text) { |
| 260 | | return document.createTextNode(text); |
| | 259 | function createText(text, clean) { |
| | 260 | return document.createTextNode(clean ? text.replace(UFE0Fg, '') : text); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
| … |
… |
var twemoji = (function ( |
| 301 | 301 | // collect them to process emoji later |
| 302 | 302 | allText.push(subnode); |
| 303 | 303 | } |
| 304 | | // ignore all nodes that are not type 1 or that |
| | 304 | // ignore all nodes that are not type 1, that are svg, or that |
| 305 | 305 | // should not be parsed as script, style, and others |
| 306 | | else if (nodeType === 1 && !shouldntBeParsed.test(subnode.nodeName)) { |
| | 306 | else if (nodeType === 1 && !('ownerSVGElement' in subnode) && |
| | 307 | !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) { |
| 307 | 308 | grabAllTextNodes(subnode, allText); |
| 308 | 309 | } |
| 309 | 310 | } |
| … |
… |
var twemoji = (function ( |
| 365 | 366 | index = match.index; |
| 366 | 367 | if (index !== i) { |
| 367 | 368 | fragment.appendChild( |
| 368 | | createText(text.slice(i, index)) |
| | 369 | createText(text.slice(i, index), true) |
| 369 | 370 | ); |
| 370 | 371 | } |
| 371 | 372 | rawText = match[0]; |
| … |
… |
var twemoji = (function ( |
| 393 | 394 | modified = true; |
| 394 | 395 | fragment.appendChild(img); |
| 395 | 396 | } |
| 396 | | if (!img) fragment.appendChild(createText(rawText)); |
| | 397 | if (!img) fragment.appendChild(createText(rawText, false)); |
| 397 | 398 | img = null; |
| 398 | 399 | } |
| 399 | 400 | // is there actually anything to replace in here ? |
| … |
… |
var twemoji = (function ( |
| 401 | 402 | // any text left to be added ? |
| 402 | 403 | if (i < text.length) { |
| 403 | 404 | fragment.appendChild( |
| 404 | | createText(text.slice(i)) |
| | 405 | createText(text.slice(i), true) |
| 405 | 406 | ); |
| 406 | 407 | } |
| 407 | 408 | // replace the text node only, leave intact |
| … |
… |
var twemoji = (function ( |
| 459 | 460 | ret = ret.concat(' ', attrname, '="', escapeHTML(attrib[attrname]), '"'); |
| 460 | 461 | } |
| 461 | 462 | } |
| 462 | | ret = ret.concat('>'); |
| | 463 | ret = ret.concat('/>'); |
| 463 | 464 | } |
| 464 | 465 | return ret; |
| 465 | 466 | }); |