Skip to content

Commit

Permalink
fix(anchors-with-no-rel): ignore same origin links (#2749)
Browse files Browse the repository at this point in the history
* fix(anchors-with-no-rel): ignore same origin links

* smokehouse expectation printing bug
  • Loading branch information
patrickhulce authored and brendankenny committed Jul 26, 2017
1 parent 428f637 commit 78ec647
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ module.exports = [
'If they are not used as hyperlinks, consider removing the _blank target.',
extendedInfo: {
value: {
length: 3
length: 2
}
},
details: {
items: {
length: 3
length: 2
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function findDifference(path, actual, expected) {
const expectedValue = expected[key];

if (!(key in actual)) {
return {keyPath, undefined, expectedValue};
return {path: keyPath, actual: undefined, expected: expectedValue};
}

const actualValue = actual[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ExternalAnchorsUseRelNoopenerAudit extends Audit {
const failingAnchors = artifacts.AnchorsWithNoRelNoopener
.filter(anchor => {
try {
return anchor.href === '' || new URL(anchor.href).host !== pageHost;
return new URL(anchor.href).host !== pageHost;
} catch (err) {
debugString = 'Lighthouse was unable to determine the destination ' +
'of some anchor tags. If they are not used as hyperlinks, ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AnchorsWithNoRelNoopener extends Gatherer {
const selector = 'a[target="_blank"]:not([rel~="noopener"])';
const elements = getElementsInDocument(selector);
return elements.map(node => ({
href: node.getAttribute('href'),
href: node.href,
rel: node.getAttribute('rel'),
target: node.getAttribute('target')
}));
Expand Down

0 comments on commit 78ec647

Please sign in to comment.