-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
report: make urls clickable #9224
Changes from 3 commits
aa94dee
5ebc419
64a7cf0
4bd8a9e
12f4728
d6eae56
fbc179f
6c43e7e
858b63a
ebeda1b
a032633
a000cb4
425d7ec
7d93bde
4707e95
c7504ab
b965f04
ccefdd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,7 @@ class DetailsRenderer { | |
} | ||
|
||
const element = this._dom.createElement('div', 'lh-text__url'); | ||
element.appendChild(this._renderText(displayedPath)); | ||
element.appendChild(this._renderAnchor(displayedPath, url)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like we should rename this method now ;) maybe we can also share some logic with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, didn't see that method. done. |
||
|
||
if (displayedHost) { | ||
const hostElem = this._renderText(displayedHost); | ||
|
@@ -160,6 +160,19 @@ class DetailsRenderer { | |
return element; | ||
} | ||
|
||
/** | ||
* @param {string} text | ||
* @param {string} href | ||
* @return {Element} | ||
*/ | ||
_renderAnchor(text, href) { | ||
const element = this._dom.createElement('a', 'lh-anchor'); | ||
element.textContent = text; | ||
element.href = href; | ||
element.target = '_blank'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't forget |
||
return element; | ||
} | ||
|
||
/** | ||
* @param {string} text | ||
* @return {Element} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing b/c of this change.
DetailsRenderer.renderTextURL
tosses the host part ifparsed.file === '/'
. Before, the chain renderer always used the results ofUtil.parseURL
w/o post-processing. The chain renderer now looks like this when run on the root url of a site:before:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an improvement, IMO.