Emoji: make sure we parse only strings or DOM nodes that have children.

Props peterwilsoncc. Fixes #32300.

git-svn-id: https://develop.svn.wordpress.org/trunk@32679 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-06-01 18:24:12 +00:00
parent b513402c28
commit 194d266afb
1 changed files with 3 additions and 1 deletions

View File

@ -120,7 +120,9 @@
* @param {Object} args Additional options for Twemoji.
*/
function parse( object, args ) {
if ( ! replaceEmoji || ! twemoji ) {
if ( ! replaceEmoji || ! twemoji || ! object ||
( 'string' !== typeof object && ( ! object.childNodes || ! object.childNodes.length ) ) ) {
return object;
}