Skip to content

Commit

Permalink
refactor(caption-evaluate): work with virtual nodes (#2491)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoyi Chen authored Aug 26, 2020
1 parent 2f1528f commit 32888d4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/checks/media/caption-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { querySelectorAll } from '../../core/utils';

function captionEvaluate(node, options, virtualNode) {
const tracks = querySelectorAll(virtualNode, 'track');
const hasCaptions = tracks.some(
({ actualNode }) =>
(actualNode.getAttribute('kind') || '').toLowerCase() === 'captions'
);
const hasCaptions = tracks.some(vNode => {
return (vNode.attr('kind') || '').toLowerCase() === 'captions';
});

// Undefined if there are no tracks - media may use another caption method
return hasCaptions ? false : undefined;
Expand Down

0 comments on commit 32888d4

Please sign in to comment.