Emoji:
- 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:
parent
94768cad74
commit
86c521d868
|
@ -370,10 +370,10 @@ twemoji = (function (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fragment.appendChild(img || createText(alt));
|
fragment.appendChild(img || createText(alt));
|
||||||
img = null;
|
|
||||||
}
|
}
|
||||||
// is there actually anything to replace in here ?
|
// is there actually anything to replace in here ?
|
||||||
if (0 < i) {
|
if (img) {
|
||||||
|
img = null;
|
||||||
// any text left to be added ?
|
// any text left to be added ?
|
||||||
if (i < text.length) {
|
if (i < text.length) {
|
||||||
fragment.appendChild(
|
fragment.appendChild(
|
||||||
|
@ -516,4 +516,4 @@ twemoji = (function (
|
||||||
return r.join(sep || '-');
|
return r.join(sep || '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
window.wp = window.wp || {};
|
window.wp = window.wp || {};
|
||||||
|
|
||||||
( function( window, wp, twemoji, settings ) {
|
( function( window, wp, twemoji, settings ) {
|
||||||
|
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
||||||
|
|
||||||
var emoji = {
|
var emoji = {
|
||||||
/**
|
/**
|
||||||
* Flag to determine if we should parse all emoji characters into Twemoji images.
|
* Flag to determine if we should parse all emoji characters into Twemoji images.
|
||||||
|
@ -68,7 +70,7 @@ window.wp = window.wp || {};
|
||||||
node = node.parentNode;
|
node = node.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( node.nodeType === 1 ) {
|
if ( node && node.nodeType === 1 ) {
|
||||||
emoji.parse( node );
|
emoji.parse( node );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +97,7 @@ window.wp = window.wp || {};
|
||||||
var canvas = document.createElement( 'canvas' ),
|
var canvas = document.createElement( 'canvas' ),
|
||||||
context = canvas.getContext && canvas.getContext( '2d' );
|
context = canvas.getContext && canvas.getContext( '2d' );
|
||||||
|
|
||||||
if ( ! context.fillText ) {
|
if ( ! context || ! context.fillText ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ window.wp = window.wp || {};
|
||||||
var canvas = document.createElement( 'canvas' ),
|
var canvas = document.createElement( 'canvas' ),
|
||||||
context = canvas.getContext && canvas.getContext( '2d' );
|
context = canvas.getContext && canvas.getContext( '2d' );
|
||||||
|
|
||||||
if ( ! context.fillText ) {
|
if ( ! context || ! context.fillText ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
*
|
*
|
||||||
* @param string The emoji base URL.
|
* @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.
|
* Filter the extension of the emoji files.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue