Make WordPress Core

Changeset 61180


Ignore:
Timestamp:
11/07/2025 02:42:41 PM (2 months ago)
Author:
desrosj
Message:

Emoji: Re-add WordPress modifications to Twemoji.

This re-adds some WordPress specific modifications to the Twemoji library that were accidentally removed in [57626] and [61134].

Unprops desrosj.
Props dd32, paulkevan, ellatrix.
See #64184.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/twemoji.js

    r61134 r61180  
    44    https://github.com/jdecked/twemoji/blob/gh-pages/LICENSE
    55  */
     6
     7  /*
     8   * Note: this file was modified in two places to add support for a doNotParse() callback.
     9   * The modifications are surrounded by `// WP start` and `// WP end` comments.
     10   */
    611
    712  // WARNING:   this file is generated automatically via
     
    306311      else if (nodeType === 1 && !('ownerSVGElement' in subnode) &&
    307312          !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) {
     313
     314        // WP start
     315        // Use doNotParse() callback if set.
     316        if ( twemoji.doNotParse && twemoji.doNotParse( subnode ) ) {
     317            continue;
     318        }
     319        // WP end
     320
    308321        grabAllTextNodes(subnode, allText);
    309322      }
     
    521534      how = {callback: how};
    522535    }
     536
     537    // WP start
     538    // Allow passing of the doNotParse() callback in the settings.
     539    // The callback is used in `grabAllTextNodes()` (DOM mode only) as a filter
     540    // that allows bypassing of some of the text nodes. It gets the current subnode as argument.
     541    twemoji.doNotParse = how.doNotParse;
     542    // WP end
     543
    523544    // if first argument is string, inject html <img> tags
    524545    // otherwise use the DOM tree and parse text nodes only
Note: See TracChangeset for help on using the changeset viewer.