Skip to content

Commit

Permalink
Merge 219b93b into 8f7ade1
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenyu committed Oct 11, 2020
2 parents 8f7ade1 + 219b93b commit 13f80e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lighthouse-core/audits/seo/crawlable-anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CrawlableAnchors extends Audit {
role = role.trim();

if (role.length > 0) return;
if (rawHref.startsWith('mailto:')) return;

const windowLocationRegExp = /window\.location=/;
const windowOpenRegExp = /window\.open\(/;
Expand Down
8 changes: 8 additions & 0 deletions lighthouse-core/test/audits/seo/crawlable-anchors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,12 @@ describe('SEO: Crawlable anchors audit', () => {
assert.equal(auditResult, 1, `'${onclickVariation}' should pass the audit`);
}
});

it('handles window.open in an onclick attribute and mailto: in a href attribute', () => {
assert.equal(
runAudit({rawHref: 'mailto:name@example.com', onclick: 'window.open()'}),
1,
'window.open in an onclick and mailto: in a href is a pass'
);
});
});

0 comments on commit 13f80e9

Please sign in to comment.