[wp-trac] [WordPress Trac] #57301: Emoji feature detection is incorrect

WordPress Trac noreply at wordpress.org
Wed Dec 14 20:33:03 UTC 2022


#57301: Emoji feature detection is incorrect
---------------------------+--------------------------------------
 Reporter:  sergiomdgomes  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Emoji          |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript, performance
---------------------------+--------------------------------------

Comment (by dmsnell):

 Thanks for the summary, @sergiomdgomes.

 Whatever we do I think we should take the opportunity to remove the
 inconsistency between listing direct code points and code unit sequences.
 That different sets of tests use the different approach for the same
 purpose is confusing and is bound to continue to lead to more confusion.

 My preference I think is also moving to strings and removing
 `fromCharCode` altogether, but I don't prefer `\u{1f3f3}` since that again
 creates a backwards compatibility problem where none needs to be. It seems
 more direct for this code to test Unicode support in the browser and not
 JavaScript support. As you note, it's not the worst problem to have, but
 in this case it seems just as easy to directly measure what we want and
 //not// introduce compatibility problems as it does to introduce them.

 So in short, `\uD83C\uDFF3\uFE0F\u200D\u26A7\uFE0F` is my preference
 because:
  - there's less code, less indirection
  - it doesn't create a browser-compatibility issue
  - it warrants a comment explaining to enter code units and avoid entering
 supplementary-plane code points
  - if someone wants to directly embed supplementary-plane characters they
 can (e.g. `πŸ‡ΊπŸ‡³`), they just can't use the escape sequence without
 translating into code units first (e.g. not `\u{1F1FA}\u{1F1F3}` but
 rather `\uD83C\uDDFA\uD83C\uDDF3`)
  - if someone //does// enter higher code points then the breakage will
 fall-back to the behavior you're proposing

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57301#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list