r88596 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88595‎ | r88596 | r88597 >
Date:19:33, 22 May 2011
Author:hartman
Status:deferred
Tags:
Comment:
Protect against undefined element.
Video/audio element is not present in dom if it has not been played yet, causing pause() to fail.
Modified paths:
  • /trunk/extensions/TimedMediaHandler/resources/mw.PopUpThumbVideo.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/resources/mw.PopUpThumbVideo.js
@@ -15,7 +15,10 @@
1616 'content' : $video,
1717 'close' : function(){
1818 // pause the video on close ( so that playback does not continue )
19 - $(this).find('video,audio').get(0).pause();
 19+ var domEl = $(this).find('video,audio').get(0);
 20+ if( domEl ) {
 21+ domEl.pause();
 22+ }
2023 }
2124 } )
2225 .css('overflow', 'hidden')
@@ -26,4 +29,4 @@
2730 });
2831 });
2932
30 -} )( mediaWiki, jQuery );
\ No newline at end of file
 33+} )( mediaWiki, jQuery );

Status & tagging log