[wp-trac] [WordPress Trac] #29767: Quicktags instances loop check for instance '0'

WordPress Trac noreply at wordpress.org
Sat Sep 27 14:42:37 UTC 2014


#29767: Quicktags instances loop check for instance '0'
--------------------------+-----------------------------
 Reporter:  afercia       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.0
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 While checking for a way to count Quicktags instances, I noticed that in
 the instances loop the check for the instance '0' was changed in strict
 equality I guess to make JSHint happy, see [changeset:"26212"]:
 changed from
 {{{
 if ( inst == 0 )
 }}}
 to
 {{{
 if ( inst === 0 )
 }}}
 AFAIK JavaScript Object property keys (names) are always string and this
 always evaluates to false so in the default Edit Post screen the loop runs
 3 times:
 0
 content
 replycontent
 Proposed patch checks for a string and uses "Yoda" style. Fixes a small
 typo in the doc.

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


More information about the wp-trac mailing list