Skip to content

Commit

Permalink
Return if href startsWith mailto
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenyu committed Oct 11, 2020
1 parent 7c14f1b commit 219b93b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion lighthouse-core/test/audits/seo/crawlable-anchors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('SEO: Crawlable anchors audit', () => {
}
});

it('handles window.open in an onclick attribute and mailto: in href attribute', () => {
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,
Expand Down

0 comments on commit 219b93b

Please sign in to comment.