Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 3 years ago

#41988 closed enhancement (fixed)

Strict comparison for JavaScript type of check at line 110 in wp-admin/admin-footer.php

Reported by: rnaby's profile rnaby Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.8 Priority: low
Severity: normal Version:
Component: Administration Keywords: 2nd-opinion
Focuses: javascript, coding-standards Cc:


The typeof checking for wpOnload variable should use === comparison operator rather than == comparison operator. It'll make variable type checking strict.

Before or now the code is-

<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>

After applying the fix, the code is-

<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>

Attachments (1)

41988.diff (466 bytes) - added by rnaby 7 years ago.
The diff patch file I generated by using RabbitVCS.

Download all attachments as: .zip

Change History (6)

7 years ago

The diff patch file I generated by using RabbitVCS.

#1 @swissspidy
7 years ago

  • Keywords 2nd-opinion added
  • Priority changed from normal to low
  • Version trunk deleted

Please note that there's #41057 to apply PHP coding standards in core once and for all. Perhaps we need a similar ticket for JS? That would be much easier than having dozens of very small tickets for things not really worth fixing on their own. In this particular section there's no bug caused by these comparisons anyway.

#2 @rnaby
6 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #41057.

#3 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review deleted

#4 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution changed from duplicate to fixed

In 50541:

Coding Standards: Use strict comparison for JS fragment in some admin files.

Follow-up to [48083].

Props nayanchamp7, rnaby.
Fixes #52845, #41988.

#5 @SergeyBiryukov
3 years ago

  • Component changed from General to Administration
  • Focuses javascript coding-standards added
  • Milestone set to 5.8
Note: See TracTickets for help on using tickets.