Make WordPress Core

Changeset 37089


Ignore:
Timestamp:
03/29/2016 02:01:18 AM (10 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.

Merge of [36817] and [36981] to the 4.4 branch.

Fixes #35977.

File:
1 edited

Legend:

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

    r36161 r37089  
    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.removeChild( node.nextSibling );
     86                                                                        }
     87                                                                }
     88
    7189                                                                node = node.parentNode;
    7290                                                        }
Note: See TracChangeset for help on using the changeset viewer.