Make WordPress Core

Changeset 36817


Ignore:
Timestamp:
03/03/2016 05:20:19 AM (9 years ago)
Author:
pento
Message:

Emoji: Add some extra IE11 compatibility.

IE 11's implementation of MutationObserver is buggy. It unnecessarily splits text nodes when it encounters a HTML template interpolation symbol ( "{{", for example ). So, we join the text nodes back together as a work-around.

Fixes #35977 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/wp-emoji.js

    r36816 r36817  
    1616        twemoji, timer,
    1717        loaded = false,
    18         count = 0;
     18        count = 0,
     19        ie11 = window.navigator.userAgent.indexOf( 'Trident/7.0' ) > 0;
    1920
    2021        /**
     
    6970
    7071                            if ( node.nodeType === 3 ) {
     72                                if ( ! node.parentNode ) {
     73                                    continue;
     74                                }
     75
     76                                if ( ie11 ) {
     77                                    /*
     78                                     * IE 11's implementation of MutationObserver is buggy.
     79                                     * It unnecessarily splits text nodes when it encounters a HTML
     80                                     * template interpolation symbol ( "{{", for example ). So, we
     81                                     * join the text nodes back together as a work-around.
     82                                     */
     83                                    while( node.nextSibling && 3 === node.nextSibling.nodeType ) {
     84                                        node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
     85                                        node.parentNode.removedChild( node.nextSibling );
     86                                    }
     87                                }
     88
    7189                                node = node.parentNode;
    7290                            }
Note: See TracChangeset for help on using the changeset viewer.