Skip to content

Commit

Permalink
MDL-75278 VideoJS: Update VideoJS to use validation helper
Browse files Browse the repository at this point in the history
  • Loading branch information
stevandoMoodle authored and Jenkins committed Nov 8, 2022
1 parent ec65857 commit d0e63f5
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 27 deletions.
4 changes: 2 additions & 2 deletions media/player/videojs/amd/build/video-lazy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion media/player/videojs/amd/build/video-lazy.min.js.map

Large diffs are not rendered by default.

80 changes: 57 additions & 23 deletions media/player/videojs/amd/src/video-lazy.js
Expand Up @@ -3512,6 +3512,7 @@
_proto.createEl = function createEl$1(tagName, properties, attributes) {
return createEl(tagName, properties, attributes);
}

/**
* Localize a string given the string in english.
*
Expand Down Expand Up @@ -18039,13 +18040,23 @@
var _proto = MenuItem.prototype;

_proto.createEl = function createEl(type, props, attrs) {
// The control is textual, not just an icon
this.nonIconControl = true;
return _ClickableComponent.prototype.createEl.call(this, 'li', assign({
var el = _ClickableComponent.prototype.createEl.call(this, type, props, attrs);
var parentSpan = _ClickableComponent.prototype.createEl.call(this, 'li', assign({
className: 'vjs-menu-item',
innerHTML: "<span class=\"vjs-menu-item-text\">" + this.localize(this.options_.label) + "</span>",
tabIndex: -1
}, props), attrs);

parentSpan.appendChild(_ClickableComponent.prototype.createEl.call(this, 'span', {
className: 'vjs-icon-placeholder'
}, {
'aria-hidden': true
}));
parentSpan.appendChild(_ClickableComponent.prototype.createEl.call(this, 'span', {
className: 'vjs-control-text',
textContent: this.localize(this.options_.label)
}));

return el;
}
/**
* Ignore keys which are used by the menu, but pass any other ones up. See
Expand Down Expand Up @@ -19109,19 +19120,23 @@
var _proto = SubsCapsMenuItem.prototype;

_proto.createEl = function createEl(type, props, attrs) {
var innerHTML = "<span class=\"vjs-menu-item-text\">" + this.localize(this.options_.label);
var el = _TextTrackMenuItem.prototype.createEl.call(this, type, props, attrs);

var parentSpan = el.querySelector('.vjs-menu-item-text');

if (this.options_.track.kind === 'captions') {
innerHTML += "\n <span aria-hidden=\"true\" class=\"vjs-icon-placeholder\"></span>\n <span class=\"vjs-control-text\"> " + this.localize('Captions') + "</span>\n ";
parentSpan.appendChild(createEl('span', {
className: 'vjs-icon-placeholder'
}, {
'aria-hidden': true
}));
parentSpan.appendChild(createEl('span', {
className: 'vjs-control-text',
// space added as the text will visually flow with the
// label
textContent: " " + this.localize('Captions')
}));
}

innerHTML += '</span>';

var el = _TextTrackMenuItem.prototype.createEl.call(this, type, assign({
innerHTML: innerHTML
}, props), attrs);

return el;
};

return SubsCapsMenuItem;
Expand Down Expand Up @@ -19270,18 +19285,22 @@
var _proto = AudioTrackMenuItem.prototype;

_proto.createEl = function createEl(type, props, attrs) {
var innerHTML = "<span class=\"vjs-menu-item-text\">" + this.localize(this.options_.label);
var el = _MenuItem.prototype.createEl.call(this, type, props, attrs);

var parentSpan = el.querySelector('.vjs-menu-item-text');

if (this.options_.track.kind === 'main-desc') {
innerHTML += "\n <span aria-hidden=\"true\" class=\"vjs-icon-placeholder\"></span>\n <span class=\"vjs-control-text\"> " + this.localize('Descriptions') + "</span>\n ";
parentSpan.appendChild(_MenuItem.prototype.createEl.call(this, 'span', {
className: 'vjs-icon-placeholder'
}, {
'aria-hidden': true
}));
parentSpan.appendChild(_MenuItem.prototype.createEl.call(this, 'span', {
className: 'vjs-control-text',
textContent: this.localize('Descriptions')
}));
}

innerHTML += '</span>';

var el = _MenuItem.prototype.createEl.call(this, type, assign({
innerHTML: innerHTML
}, props), attrs);

return el;
}
/**
Expand Down Expand Up @@ -33106,7 +33125,22 @@
return buf.push(' ', node.name, '="', node.value.replace(/[<&"]/g, _xmlEncoder), '"');

case TEXT_NODE:
return buf.push(node.data.replace(/[<&]/g, _xmlEncoder));
/**
* The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
* except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
* If they are needed elsewhere, they must be escaped using either numeric character references or the strings
* `&amp;` and `&lt;` respectively.
* The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
* be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
* when that string is not marking the end of a CDATA section.
*
* In the content of elements, character data is any string of characters
* which does not contain the start-delimiter of any markup
* and does not include the CDATA-section-close delimiter, `]]>`.
*
* @see https://www.w3.org/TR/xml/#NT-CharData
*/
return buf.push(node.data.replace(/[<&]/g, _xmlEncoder).replace(/]]>/g, ']]&gt;'));

case CDATA_SECTION_NODE:
return buf.push('<![CDATA[', node.data, ']]>');
Expand Down
8 changes: 7 additions & 1 deletion media/player/videojs/readme_moodle.txt
Expand Up @@ -61,4 +61,10 @@ Import plugins:
with
var OGVCompat__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVCompat);
var OGVLoader__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVLoader);
var OGVPlayer__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVPlayer);
var OGVPlayer__default = /*#__PURE__*/_interopDefaultLegacy(ogvBase.OGVPlayer);

Changes:
In order to improve the validation, a couple of minor changes have been added to the video-lazy.js:
1. Partial upgrade from VideoJS 7.17.0 for 'Subtitles' label check in 18043 - 18059
2. Partial upgrade from VideoJS 7.17.0 for 'Captions' label check from 19123 - 19138
3. Partial upgrade from VideoJS 7.17.0 for 'Description' label check from 19288 - 19302

0 comments on commit d0e63f5

Please sign in to comment.