Opened 12 years ago
Closed 12 years ago
#29767 closed defect (bug) (fixed)
Quicktags instances loop check for instance '0'
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.1 | Priority: | normal |
| Severity: | normal | Version: | 4.0 |
| Component: | Editor | Keywords: | has-patch |
| Focuses: | javascript | Cc: |
Description
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 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.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Patch looks good.