Skip to content

Commit 78ec647

Browse files
patrickhulcebrendankenny
authored andcommitted
fix(anchors-with-no-rel): ignore same origin links (#2749)
* fix(anchors-with-no-rel): ignore same origin links * smokehouse expectation printing bug
1 parent 428f637 commit 78ec647

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lighthouse-cli/test/smokehouse/dobetterweb/dbw-expectations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ module.exports = [
4242
'If they are not used as hyperlinks, consider removing the _blank target.',
4343
extendedInfo: {
4444
value: {
45-
length: 3
45+
length: 2
4646
}
4747
},
4848
details: {
4949
items: {
50-
length: 3
50+
length: 2
5151
}
5252
}
5353
},

lighthouse-cli/test/smokehouse/smokehouse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function findDifference(path, actual, expected) {
163163
const expectedValue = expected[key];
164164

165165
if (!(key in actual)) {
166-
return {keyPath, undefined, expectedValue};
166+
return {path: keyPath, actual: undefined, expected: expectedValue};
167167
}
168168

169169
const actualValue = actual[key];

lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ExternalAnchorsUseRelNoopenerAudit extends Audit {
3939
const failingAnchors = artifacts.AnchorsWithNoRelNoopener
4040
.filter(anchor => {
4141
try {
42-
return anchor.href === '' || new URL(anchor.href).host !== pageHost;
42+
return new URL(anchor.href).host !== pageHost;
4343
} catch (err) {
4444
debugString = 'Lighthouse was unable to determine the destination ' +
4545
'of some anchor tags. If they are not used as hyperlinks, ' +

lighthouse-core/gather/gatherers/dobetterweb/anchors-with-no-rel-noopener.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AnchorsWithNoRelNoopener extends Gatherer {
1919
const selector = 'a[target="_blank"]:not([rel~="noopener"])';
2020
const elements = getElementsInDocument(selector);
2121
return elements.map(node => ({
22-
href: node.getAttribute('href'),
22+
href: node.href,
2323
rel: node.getAttribute('rel'),
2424
target: node.getAttribute('target')
2525
}));

0 commit comments

Comments
 (0)