[wp-trac] [WordPress Trac] #32300: twemoji.js - validate nodes passed to parseNode

WordPress Trac noreply at wordpress.org
Fri May 8 02:02:29 UTC 2015

#32300: twemoji.js - validate nodes passed to parseNode
 Reporter:  peterwilsoncc  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Formatting     |    Version:  4.2
 Severity:  normal         |   Keywords:
  Focuses:  javascript     |
 Per #32109 passing an null or undefined node to twemoji for parsing throws
 a fatal JavaScript error.

 I propose validating the data before attempting to emojify it.
 `grabAllTextNodes` assumes the presence of `node.childNodes`, so it's
 worth checking for that too.

 Following a discussion with @azaozz, I'll upload two options:

 *.1.diff - checks neither node or node.childNodes are null
 *.2.diff - checks neither node or node.textContent are null or undefined

Ticket URL: <https://core.trac.wordpress.org/ticket/32300>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list