- Patch twemoji.js to prevent infinite loop.
- Fix some `undefined` errors in old IE.
Props iseulde. See #31242.

git-svn-id: https://develop.svn.wordpress.org/trunk@31756 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-12 19:52:13 +00:00
parent 94768cad74
commit 86c521d868
3 changed files with 9 additions and 7 deletions

View File

@ -370,10 +370,10 @@ twemoji = (function (
}
}
fragment.appendChild(img || createText(alt));
img = null;
}
// is there actually anything to replace in here ?
if (0 < i) {
if (img) {
img = null;
// any text left to be added ?
if (i < text.length) {
fragment.appendChild(
@ -516,4 +516,4 @@ twemoji = (function (
return r.join(sep || '-');
}
}());
}());

View File

@ -1,6 +1,8 @@
window.wp = window.wp || {};
( function( window, wp, twemoji, settings ) {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var emoji = {
/**
* Flag to determine if we should parse all emoji characters into Twemoji images.
@ -68,7 +70,7 @@ window.wp = window.wp || {};
node = node.parentNode;
}
if ( node.nodeType === 1 ) {
if ( node && node.nodeType === 1 ) {
emoji.parse( node );
}
}
@ -95,7 +97,7 @@ window.wp = window.wp || {};
var canvas = document.createElement( 'canvas' ),
context = canvas.getContext && canvas.getContext( '2d' );
if ( ! context.fillText ) {
if ( ! context || ! context.fillText ) {
return false;
}
@ -123,7 +125,7 @@ window.wp = window.wp || {};
var canvas = document.createElement( 'canvas' ),
context = canvas.getContext && canvas.getContext( '2d' );
if ( ! context.fillText ) {
if ( ! context || ! context.fillText ) {
return false;
}

View File

@ -434,7 +434,7 @@ function wp_default_scripts( &$scripts ) {
*
* @param string The emoji base URL.
*/
'baseUrl' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72/' ),
'baseUrl' => apply_filters( 'emoji_url', '//s0.wp.com/wp-content/mu-plugins/emoji/twemoji/72x72' ),
/**
* Filter the extension of the emoji files.
*