Skip to content

Commit

Permalink
refactor(title-only-evaluate): work with virtual nodes (#2489)
Browse files Browse the repository at this point in the history
  • Loading branch information
xyc authored and straker committed Sep 8, 2020
1 parent 7894d76 commit ed6fa45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/checks/label/title-only-evaluate.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { labelVirtual } from '../../commons/text';
import { labelVirtual, titleText } from '../../commons/text';

function titleOnlyEvaluate(node, options, virtualNode) {
var labelText = labelVirtual(virtualNode);
return (
!labelText &&
!!(node.getAttribute('title') || node.getAttribute('aria-describedby'))
);
const labelText = labelVirtual(virtualNode);
const title = titleText(virtualNode);
const ariaDescribedBy = virtualNode.attr('aria-describedby');

return !labelText && !!(title || ariaDescribedBy);
}

export default titleOnlyEvaluate;

0 comments on commit ed6fa45

Please sign in to comment.