Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: report all indeterminable anchors #1358

Merged
merged 2 commits into from
Dec 29, 2016
Merged

fix: report all indeterminable anchors #1358

merged 2 commits into from
Dec 29, 2016

Conversation

patrickhulce
Copy link
Collaborator

R: @ebidel

Changes rel noopener audit to warn about all potentially violating anchor tags even when URL is malformed.

Addresses #1345

Changes rel noopener audit to warn about all potentially violating anchor tags even when URL is malformed.

Addresses #1345
return new URL(anchor.href).host !== pageHost;
} catch (err) {
debugString = 'Lighthouse was unable to determine the destination ' +
'of some anchor tags. Remove the href attribute if they are not ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the things Brendan discovered in the last PR for this audit was that many SPAs don't include an href attr and use click handlers instead. You catch will include those cases, but maybe we should modify the debug string to say so. E.g. the missing href is intentional in their app, but we're still saying remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOW might want to to still one off the href === "" case

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I didn't realize anchor.href === '' would be true even if it didn't have an href at all. This seems like an ambiguous case then. There'd be a false positive most of the time if we warn for all missing hrefs but it's feasible they still send externally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, SG then I'll add it back in.

@ebidel
Copy link
Contributor

ebidel commented Dec 29, 2016 via email

@ebidel ebidel merged commit 4ae5e11 into master Dec 29, 2016
@patrickhulce patrickhulce deleted the fix_bad_anchor_href branch December 29, 2016 22:28
andrewrota pushed a commit to andrewrota/lighthouse that referenced this pull request Jan 13, 2017
* fix: report all indeterminable anchors

Changes rel noopener audit to warn about all potentially violating anchor tags even when URL is malformed.

Addresses GoogleChrome#1345

* feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants