Skip to content

Commit

Permalink
MDL-57101 media_videojs: Dynamic loader works on self-matching nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Dec 1, 2016
1 parent 36e6789 commit b52c562
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/loader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions media/player/videojs/amd/src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ define(['jquery', 'media_videojs/video'], function($, videojs) {
* @param {NodeList} nodes List of new nodes.
*/
var notifyVideoJS = function(e, nodes) {
nodes.find('.mediaplugin_videojs audio, .mediaplugin_videojs video')
.each(function() {
var selector = '.mediaplugin_videojs';

// Find the descendants matching the expected parent of the audio and video
// tags. Then also addBack the nodes matching the same selector. Finally,
// we find the audio and video tags contained in those parents. Kind thanks
// to jQuery for the simplicity.
nodes.find(selector)
.addBack(selector)
.find('audio, video').each(function() {
var id = $(this).attr('id'),
config = $(this).data('setup');

Expand Down

0 comments on commit b52c562

Please sign in to comment.