[wp-trac] [WordPress Trac] #40354: Improper use of jQuery hasClass method

WordPress Trac noreply at wordpress.org
Tue Apr 4 14:32:18 UTC 2017


#40354: Improper use of jQuery hasClass method
--------------------------+-----------------------------
 Reporter:  kostasx       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.7.3
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 According to the jQuery documentation (https://api.jquery.com/hasclass/),
 the .hasClass() method accepts a class name without a prefixed . dot.
 An improper use of the method's argument, that includes the dot, has been
 found in the following files:

 /wp-includes/js/mediaelement/wp-mediaelement.js
 Line #47
 {{{
 return ! $( this ).parent().hasClass( '.mejs-mediaelement' );
 }}}

 Should be:

 {{{
 return ! $( this ).parent().hasClass( 'mejs-mediaelement' );
 }}}

 /wp-includes/js/mediaelement/wp-mediaelement.min.js

 Line #1

 {{{
 return!b(this).parent().hasClass(".mejs-mediaelement")
 }}}

 Should be:

 {{{
 return!b(this).parent().hasClass("mejs-mediaelement")
 }}}

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


More information about the wp-trac mailing list