[wp-trac] [WordPress Trac] #52219: wp-emoji.js should always skip nodes with the `wp-exclude-emoji` CSS class
WordPress Trac
noreply at wordpress.org
Mon Aug 1 04:16:24 UTC 2022
#52219: wp-emoji.js should always skip nodes with the `wp-exclude-emoji` CSS class
--------------------------+------------------------------
Reporter: GeorgeJipa | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Emoji | Version: 4.2.2
Severity: normal | Resolution:
Keywords: | Focuses: javascript
--------------------------+------------------------------
Changes (by dd32):
* version: 5.6 => 4.2.2
Comment:
Relevant code:
https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/wp/emoji.js?marks=148-170#L140
The only place the `wp-exclude-emoji` class is checked is within the
MutationObserver, which is only called for DOM insertions. It appears that
this is probably intentional, based on the original implementation via
#32197
`parse( document.body )` causes Twemoji to process every textnode, and the
callback presented provides no context as to what element it's operating
on - so we can't even return false there (to cause it to generate no img
replacement).
The reference below to `twemoji.parentNode` gave me hope, but this appears
not to be set anywhere I can find (either while debugging, or looking at
the twemoji source).
I suspect this is going to require an upstream bug report to allow some
form of context to be made available to the callback, so that we can
return a falsey value here to abort the replacement.
Setting version to 4.2.2, as it appears this has always been how this
functionality works.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52219#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list