core(audit): Ignore href=javascript:.* for rel=noopener audit#3574
core(audit): Ignore href=javascript:.* for rel=noopener audit#3574paulirish merged 6 commits intoGoogleChrome:masterfrom
Conversation
d9b2a37 to
d05f19c
Compare
ca1228c to
b661b02
Compare
|
@patrickhulce I'm not sure how to fix the commitlint error. It doesn't seem to consider rebased commits. Everything else seems to be passing. |
| }) | ||
| .filter(anchor => { | ||
| // Ignore href's that do not redirect to a new url | ||
| return !/javascript:.*/.test(anchor.href); |
There was a problem hiding this comment.
wouldn't this be better?
return !/^javascript:/.test(anchor.href); just to make sure the string starts with javascript:
There was a problem hiding this comment.
@wardpeet Thats a good idea. Makes it much more robust. Done!
| } | ||
| }) | ||
| .filter(anchor => { | ||
| // Ignore href's that do not redirect to a new url |
There was a problem hiding this comment.
Ignore href's that are not real links
| }) | ||
| .filter(anchor => { | ||
| // Ignore href's that do not redirect to a new url | ||
| return !/^javascript:/.test(anchor.href); |
|
@paulirish I was going through #3490 and based on the tests (https://github.com/GoogleChrome/lighthouse/pull/3490/files#diff-8f19451b89a25fa6b1259f337761d2cbR59) I think we should be doing a case insensitive check of |
brendankenny
left a comment
There was a problem hiding this comment.
I think we should be doing a case insensitive check of javascript:, unless i'm mistaken. Thoughts?
looks like it is case insensitive, so sounds good
|
@brendankenny I meant that |
|
Bump. |
|
we could do @karanjthakkar Chrome Dev Summit just happend so the team had some other priorities. Thanks for being so patient! |
|
@wardpeet So sorry about that. It totally slipped my mind. I appreciate you circling back with a reply. I've made the changes 👍 |
patrickhulce
left a comment
There was a problem hiding this comment.
lgtm thanks @karanjthakkar!
| }) | ||
| .filter(anchor => { | ||
| // Ignore href's that are not real links | ||
| return ( |
There was a problem hiding this comment.
nit: we could probably simplify this to !anchor.href || !anchor.href.toLowerCase().startsWith('javascript:')
Fixes #3079
PS: Happy to close this if @akonchady has another implementation in place already.#3079 (comment)