r113730 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113729‎ | r113730 | r113731 >
Date:16:09, 13 March 2012
Author:jdlrobson
Status:ok
Tags:
Comment:
correct typo in hasClass deal with bad arguments

should split on spaces
be aware that sometimes an element might not exist
in which case use a dummy element not in the dom
Modified paths:
  • /trunk/extensions/MobileFrontend/javascripts/application.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/javascripts/application.js
@@ -35,10 +35,12 @@
3636 if( document.querySelectorAll ) {
3737 return [].slice.call( document.querySelectorAll( el ) );
3838 }
 39+ } else if( !el ) {
 40+ el = document.createElement( 'div' );
3941 }
4042
4143 function hasClass( name ) {
42 - var classNames = el.className.split( '' );
 44+ var classNames = el.className.split( ' ' );
4345 return classNames.indexOf( name ) > -1;
4446 }
4547

Follow-up revisions

RevisionCommit summaryAuthorDate
r114201MFT r113486, r113488, r113512, r113553, r113640, r113642, r113644, r113645, r...awjrichards22:18, 19 March 2012

Status & tagging log