Skip to content

Commit

Permalink
Use a regex for testing in link-req-noopener
Browse files Browse the repository at this point in the history
  • Loading branch information
mlochbaum committed Dec 17, 2018
1 parent d901548 commit 184b348
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/link-req-noopener.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ module.exports.lint = function (element, opts) {
return a && a.value && a.value;
}

var noopen = ['noopener', 'noreferrer'];
var noopen = /(^| )(noopener|noreferrer)( |$)/;

var attrs = element.attribs;
if (getVal(attrs.target) === '_blank' &&
!noopen.some(no => (getVal(attrs.rel) || '').split(' ').some(rel => rel === no))) {
!noopen.test(getVal(attrs.rel))) {
return new Issue('E058', element.openLineCol);
}
return [];
Expand Down

0 comments on commit 184b348

Please sign in to comment.